A method for controlling the use of hardware resources of a computer system by an application that is executed on an operating system comprising at least one application programming interface that is executed on this computer system, using an executable piece of code adapted for being injected into a process belonging to the application the method comprising: ▪ intercepting a call from the process belonging to the application to an application programming interface service, wherein the intercepting at least comprises redirecting an application programming interface service to a corresponding service comprised in the piece of code and ▪ acting on a software entity belonging to the process being executed on the basis of the interception of the call from the process to the application programming interface service, wherein the application programming interface service is a service related with the software entity belonging to the process, this service being intended for the creation of new threads of execution, and wherein the software entity is a thread of execution, the method being characterized in that acting on a software entity belonging to the process being executed on the basis of the interception of the call from the process to the application programming interface service comprises: ▪ determining a yield value of the application being executed by: ∘ establishing as a control point an application programming interface service which the process will iteratively call while it is being executed; ∘ determining the time lapsed between a first call and a second call to this service by the process; and ∘ obtaining a yield value of the application being executed on the basis of the time that is determined; ▪ verifying if this yield value of the application exceeds a threshold value; and ▪ in the event of a positive result, suspending the threads of execution for a predetermined time on the basis of the identifiers stored in a second variable which maintains the register of the threads of execution created. ▪ intercepting a call from the process belonging to the application to an application programming interface service, wherein the intercepting at least comprises redirecting an application programming interface service to a corresponding service comprised in the piece of code and ▪ acting on a software entity belonging to the process being executed on the basis of the interception of the call from the process to the application programming interface service, ▪ determining a yield value of the application being executed by: ∘ establishing as a control point an application programming interface service which the process will iteratively call while it is being executed; ∘ determining the time lapsed between a first call and a second call to this service by the process; and ∘ obtaining a yield value of the application being executed on the basis of the time that is determined; ∘ establishing as a control point an application programming interface service which the process will iteratively call while it is being executed; ∘ determining the time lapsed between a first call and a second call to this service by the process; and ∘ obtaining a yield value of the application being executed on the basis of the time that is determined; ▪ verifying if this yield value of the application exceeds a threshold value; and ▪ in the event of a positive result, suspending the threads of execution for a predetermined time on the basis of the identifiers stored in a second variable which maintains the register of the threads of execution created.