Giter Club home page Giter Club logo

appower's Introduction

Power Consumption Measurement Mini-Program (Appower)

Overview

Appower uses the Intel Running Application Power Limit (RAPL) through the raplcap library, which provides a C interface for interacting with RAPL. However, RAPL only provides the energy consumption of the entire CPU. Appower is developed to measure the specific power consumption of a single software application running on a Linux computer with an Intel processor.

Prerequisites

Before using Appower, ensure you have the following prerequisites installed on your Linux environment (Ubuntu focal):

  • Linux environment (Ubuntu focal) with Intel processor
  • Python 3
  • Pip
  • CMake

Installation

To install Appower on your system, follow change to project root and run installation script

cd appower
source ./install

Always activate virtual environment with source .venv/bin/activate before using, because required libraries were installed there

Usage

To use Appower, you can run it from the terminal and specify the path to the executable and its arguments:

./appower /path/to/executable arg1 arg2 arg3

Note: Appower uses RAPL, which requires elevated permissions (sudo). Therefore, root user permission will be required.

Example

An example program has been provided at the project level directory to demonstrate how to use Appower:

(.venv)$: ./appower
Please enter the full path of the application/program (must be an executable):
/home/your_username/projects/test_appower 30

Implementation Details

TL;DR (Too Long; Didn't Read)

  • Power consumed by the CPU while the application is not running: x
  • Power consumed by the CPU while the application is running: x + a (where a is the additional power consumed by the application)
  • Power consumed by the application alone: a (obtained by subtracting x from x + a)

Steps to Measure Application Power Consumption

  1. CPU Selection: The application process and its children processes' CPU affinity are set to a single processor to ensure proper energy reading from a specific CPU.

  2. Energy Monitoring: The initial energy reading (before application execution) of the RAPL PACKAGE ZONE is recorded.

  3. Application Execution: The target application is executed with the provided arguments.

  4. Energy Monitoring (After Execution): The final energy reading is obtained after the application completes.

  5. Power Consumption Calculation: The energy consumed by the application is calculated as the difference between the final and initial energy readings.

  6. Baseline Power Consumption: To exclude background application data, the power consumption of the CPU during normal operation is measured over a specific period (default: 60 seconds).

  7. Final Power Consumption: The power consumed by the application alone is obtained by subtracting the baseline power consumption from the total power consumption.

appower's People

Contributors

timadey avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.