Identifying code that wastes time switching tasks
AssigneeInternational Business Machines Corporation
InventorKirk J. Krauss
Life of this patent
Estimating the term…
Abstract
A method of detecting portions of code of a computer program that protect resources of a computer system unnecessarily can include identifying threads and synchronization objects that are used by a computer program during execution, determining the number of threads that have accessed each resource while it has been consistently protected by a particular synchronization object, and indicating whether the resource is suited for protection according to the number of threads that have accessed the resource.
Claims20
A method of detecting portions of code of a computer program that protect resources of a computer system, comprising:
- identifying a synchronization object engaged by a thread of the computer program;
- recording, while the synchronization object is engaged,
- each access of a resource, of the computer system, that is protected by the synchronization object and
- a thread associated with the access;
- determining, upon the synchronization object being disengaged, a number of threads that have accessed the resource while the resource was protected by the synchronization object during execution of the computer program;
- and
- indicating, according to the number of threads, whether the resource is suited for protection.
A method of detecting portions of code of a multithreaded computer program that cause task switching within a computer system, comprising:
- identifying resources protected by synchronization objects during execution of the multithreaded computer program;
- counting instances during execution of the multithreaded computer program in which a resource that is protected by a synchronization object is accessed by only a single thread that engaged the synchronization object;
- and
- indicating that resources accessed by only the single thread that engaged the synchronization object during execution of the multithreaded program are unsuitable for protection by a synchronization object.
A computer program product comprising computer usable memory having stored therein computer usable program code for detecting portions of code of a computer program that protect resources of a computer system, the computer usable program code which when executed by a computer hardware device, causes the computer hardware device to perform:
- identifying resources protected by synchronization objects during execution of the multithreaded computer program;
- counting instances during execution of the multithreaded computer program in which a resource that is protected by a synchronization object is accessed by only a single thread that engaged the synchronization object;
- and
- indicating that resources accessed by only the single thread that engaged the synchronization object during execution of the multithreaded program are unsuitable for protection by a synchronization object.
Dependencies are inferred from the claim text.