Please download the dossier by clicking on the dossier button x
×

System and Method for Energy Profiling Asynchronous API Calls

  • US 20190324513A1
  • Filed: 04/23/2019
  • Published: 10/24/2019
  • Est. Priority Date: 04/23/2018
  • Status: Active Grant
First Claim
Patent Images

1. A method for profiling energy usage of invoking an application programming interface (API) by an application in a computing device, comprising:

  • obtaining source code “

    A”

    for the API;

    identifying each class Ci in the A for the API that contains a callback function Di;

    modifying each Ci by adding a callback function identifier field that is initiated to a unique value Vj upon instantiation of each object Oj that belongs to class Ci;

    identifying each location Ek in the A that posts the callback function Di for asynchronous execution by enqueueing object Oj instantiated from the Ci containing the callback function Di into the system callback queue;

    modifying the A at location Ek by adding a logging function call L to log the callback function identifier Vj and the current call stack into the energy profiling log;

    obtaining source code B in the operating system/framework that asynchronously executes any D passed from the API;

    identifying each location F in the B that invokes the callback function associated with any object dequeued from the system callback queue;

    modifying the B at the F by adding logging function calls L before and after the callback function invocation to log the callback function identifier Vj of the dequeued object when we start and finish executing the callback function respectively to the energy profiling log;

    executing the application thereby generating one or two threads, wherein the first thread executes the API call that posts the callback function Di and wherein the second thread which can be the same as the first thread dequeues the callback function Di and invokes the callback function Di;

    determining the caller-caller relationship between the function in the API execution stack that posted each Di and the asynchronously invoked callback function by processing the logged callback function ID information and call stack information in the energy profiling log;

    determining the energy usage of invoking the API call in thread 1, by monitoring activities of a processor, the processor operating any component that consumes power in the computing device in response to execution of the API;

    determining the energy usage of invoking each callback function in thread 2, by monitoring activities of a processor, the processor operating any component that consumes power in the computing device in response to execution of the callback function;

    adding the energy usage of invoking every callback function in thread 2 to the energy usage of invoking the API thus determined; and

    attributing the combined energy to the API invocation.

View all claims
  • 1 Assignment
Timeline View
Assignment View
    ×
    ×