IP Library Granted Patent US 11,107,179
Granted Patent B2
US 11,107,179 · App. 16/392,518 · Granted Aug 31, 2021

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

Inventors: Yu Charlie Hu (West Lafayette, IN); Ning Ding (Santa Clara, CA)
Assignee: Purdue Research Foundation
G06T1/20G06F1/28G06F9/451G06F11/3024G06F11/3058G06T2200/24
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,107,179
App. No.
16/392,518
Granted
Aug 31, 2021
Kind
B2
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 (15)

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.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jul 29, 2021
From: HU, Y. CHARLIE; DING, NING
To: PURDUE RESEARCH FOUNDATION
Reel/Frame 057015/0280 →
Continuity (2)
Provisional Application 62661314 · Apr 23, 2018
Related Publication 20190324513A1 · Oct 24, 2019