US11107179B2ActiveUtilityA1

System and method for profiling energy usage of API calls that asynchronously invoke functions

65
Assignee: PURDUE RESEARCH FOUNDATIONPriority: Apr 23, 2018Filed: Apr 23, 2019Granted: Aug 31, 2021
Est. expiryApr 23, 2038(~11.8 yrs left)· nominal 20-yr term from priority
G06F 11/3058G06F 11/302G06F 2201/865G06F 11/3024G06F 9/451G06F 11/3062G06F 1/28G06T 1/20G06T 2200/24
65
PatentIndex Score
0
Cited by
9
References
1
Claims

Abstract

A method for profiling energy usage of invoking an application programming interface (API) by an application in a computing device. The method includes obtaining source code for the API, modifying each class by adding a callback function identifier field that is initiated to a unique value upon instantiation of each object that belongs to the class, identifying each location in the source code that posts the callback function for asynchronous execution by enqueueing each object instantiated from the class containing the callback function into the system callback queue, modifying the source code to log the callback function identifier of object at the location that dequeues objects from the system callback queue, modifying source code by adding two system logging function calls to log the callback function identifier of the dequeued object before and after executing the callback function, executing the application, and performing energy accounting of the asynchronous API calls.

Claims

exact text as granted — not AI-modified
The invention claimed is: 
     
       1. A method for profiling energy usage of invoking an application programming interface (API) by an application that asynchronously invokes a callback function in a computing device, comprising:
 obtaining source code “A” for the API A i ; 
 identifying each class C i  in the source code A for the API A i  that contains a callback function D i ; 
 modifying each class C i  by adding a callback function identifier (ID) field that is initiated to a unique value V j  upon instantiation of each object O j  that belongs to class C i ; 
 identifying each location E k  in the source code A that posts the callback function D i  for asynchronous execution by enqueueing object O j  instantiated from the class C i  containing the callback function D i  into a callback queue; 
 modifying the source code A at location E k  by adding a logging function call L to log the callback function ID V j  and current call stack into an energy profiling log; 
 obtaining source code B responsible for asynchronously executing callback functions passed from the API in the callback queue; 
 identifying each location F in the source code B that invokes the callback function associated with any object dequeued from the callback queue; 
 modifying the source code B at the location F by calling logging functions L before and after the callback function invocation to log the callback function identifier of the dequeued object into the energy profiling log; 
 executing the application thereby generating a first thread and a second thread, wherein the first thread executes a call to the API A i  that posts the callback function D i  and wherein the second thread i) dequeues the callback function D i , and ii invokes the callback function D i ; 
 determining the caller callee relationship between the API A i  (caller) that posted D i , and the corresponding the asynchronously invoked asynchronous invocation of D j  (callee), by matching the logged callback function IDs in the energy profiling log; 
 determining the energy usage of invoking the API A i  call in thread 1; 
 determining the energy usage of the execution of callback function D i  in thread 2; 
 adding the energy usage of executing callback function D i  in thread 2 to the energy usage of invoking the API A i  in thread 1; and 
 attributing the combined energy to the API A i  invocation.

Cited by (0)

No later patents cite this yet.

References (0)

No backward citations on record.