Asynchronous API Energy Profiling via Callback ID Logging

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Modern mobile devices face challenges in accurately profiling energy usage of APIs, especially when these APIs are called asynchronously and are multi-layered, making it difficult to debug and account for energy consumption due to unclear sources of function calls.

Innovation Solution

A method is introduced that involves modifying API source code to include callback function identifiers, logging energy usage across system layers, and using a hybrid power model to track energy consumption, enabling accurate attribution of energy usage to API invocations by monitoring processor activities and logging callback function information.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If asynchronous API calls are implemented to improve system responsiveness and programming flexibility, then system performance and adaptability are improved, but energy usage tracking and debugging become extremely difficult due to unclear caller-callee relationships

Engineering Contradiction:
Improveprogramming flexibilityVSAvoidenergy usage tracking
Core Design Contradiction:
Adaptability or versatilityVSDifficulty of detecting and measuring

Solution Approach 1:

The patent applies preliminary action by assigning unique callback function identifiers to each callback function before it is posted for asynchronous execution. This pre-identification enables the system to track and attribute energy consumption to specific API calls even when executed asynchronously, resolving the measurement difficulty without compromising programming flexibility

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent implements feedback mechanisms through logging functions that record callback function identifiers, call stacks, and energy consumption data. This feedback loop allows the system to trace asynchronous execution back to its source and accurately attribute energy usage, maintaining both flexibility and measurability

Inventive Principle:
Principle #23Feedback

2Productivity

If multi-layered APIs are used to achieve complex functionality and code reuse, then system versatility and productivity are improved, but energy consumption attribution becomes ambiguous due to multiple layers calling the same functions

Engineering Contradiction:
Improvecode reuseVSAvoidenergy consumption attribution
Core Design Contradiction:
ProductivityVSMeasurement precision

Solution Approach 1:

The patent segments the energy consumption measurement by capturing call stack information at each layer of the API hierarchy. This segmentation allows the system to distinguish which specific layer initiated a function call, enabling precise energy attribution even in multi-layered architectures where code reuse occurs

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces an intermediary logging mechanism that acts as a mediator between multiple API layers and the energy measurement system. This intermediary captures and records the unique identifier and call stack context, allowing accurate tracing of energy consumption through multiple layers without affecting the underlying code reuse

Inventive Principle:
Principle #24Intermediary (Mediator)

3Measurement precision

If comprehensive logging of callback functions is implemented to improve energy profiling accuracy, then measurement precision is improved, but system complexity and overhead increase due to modifications required across multiple source files

Engineering Contradiction:
Improveenergy profiling accuracyVSAvoidsystem complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent creates a universal callback function identifier assignment mechanism that can be applied across multiple API layers and source files through a consistent interface. This universal approach enables comprehensive energy profiling without requiring complex, customized modifications for each specific case, thereby reducing overall system complexity while maintaining high measurement precision

Inventive Principle:
Principle #6Universality (Multi-functionality)

Data Source

PatentUS11551327B2System and method for energy profiling asynchronous API calls
Publication Date: 2023.01.10 PURDUE RES FOUND
  • US11551327B2 patent drawing
  • US11551327B2 patent drawing
  • US11551327B2 patent drawing

AI summary

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.