Code Monkey home page Code Monkey logo

manai's Introduction

MANAi - An IntelliJ Plugin for Software Energy Consumption Profiling

MANAi Tests

MANAi provides ease of use for energy consumption profiling on Intel-based PCs and Macs. MANAi leverages Intel's Running Average Power Limit (RAPL) to provide feedback to developers from within Jetbrain's Intellij IDEA development tool platform.

Once MANAi is installed and configured correctly, one can execute unit tests in Java projects using the respective MANAi command runner in IDEA. Recorded samples are mapped to the respective program unit in the development environment and energy data is being presented. The following screenshot shows a method that was executed using MANAi. The color coding gives feedback to the developer on the energy characteristics of respective methods.

Motivation

Understanding the energy implications of software design choices can play a crucial role towards developing sustainable software. MANAi helps developers, researcher and students alike to make energy consumption explicit by providing a wide range of visualisation and tools for energy-aware development, straight within an integrated development.

Getting Started

Prerequisites

MANAi relies on Intel's Running Average Power Limit (RAPL). Before using MANAi please ensure that your system supports RAPL.

Linux and Apple Users

The Linux and OsX-based version relies on measurements obtained using an adapted version of the C++ Mozilla RAPL implementation. Refer to https://firefox-source-docs.mozilla.org/performance/tools_power_rapl.html for details on Mozilla RAPL.

⚠️ Be aware, that MANAi only supports Intel-based Mac systems.

Windows Users

The Windows version utilizes Intel's Power Gadget which needs to be installed before using the plugin. You can obtain Intel Power Gadget via the following link https://www.intel.com/content/www/us/en/developer/articles/tool/power-gadget.html. After download, run the installer and test run the power gadget app to verify that obtaining energy measurements is available on your system.

Maven

MANAi uses Apache Maven for communication between an application under test and the Intellij plugin. In order to properly execute a MANAi test run, ensure Apache Maven is installed on your system and properly configured. MANAi processes the M2_HOME environment variable, so ensure it is set and pointing to a valid maven installation directory. The plugin was tested with Apache Maven 3.8.4.

Additionally, for MANAi to execute the mvn command directly, be sure to update your PATH-Variable accordingly.

Installation

MANAi can either be installed and used from one of the published pre-packaged binaries, or you can build it yourself directly from source (work-in-progress).

Installation from Pre-Built Binaries

We provide a set of pre-built binaries which are ready to use. Just select the correct binary depending on the system you are working with, download it and install the plugin using Intellij's internal plugin mechanism.

https://zenodo.org/record/6405335#.YkcC2y-21hE

Installation from Source

  • ⚠️ Installation from source requires two additional dependencies, which we currently do not include in this repository. However, we are working on distributing them via Maven central repository in near future.

Verfiy MANAi Installation

After installing the MANAi plugin upon first startup of the plugin,
MANAi asks to install dependencies. These dependencies are required for energy experiment execution and are installed into you local maven repository which defaults to ~/.m2.

If the dependency installation fails one reasons might be an invalid system configuration might not be valid. To verify if all prerequisists are met you can open IntelliJ's preferences and proceed to Language Tools, Framworks & rarr; MANAi. On the MANAi settings page, click the Verify Installation Link. If your configuration is correct, all entries should show a green checkmark icon.

Usage

MANAi can be used directly from within your IntelliJ installation. Once installed, you are able to define new energy experiments and execute them based on defined unit test methods. To get you up and running follow the step by step guide on how to prepare a Java project for MANAi software energy profiling.

Project Setup and Preliminaries

MANAi currently only supports maven-managed Java projects. Therefore, as a preliminary step create a new Maven project from within IntelliJ which you would like to use as a foundation for your energy experiments.

  • Use whatever project coordinates you like, but ensure to add the following dependencies to the project's object model pom.xml file
 <dependencies>
    <!-- this dependency is required for compilation -->
    <dependency>
        <groupId>at.mana</groupId>
        <artifactId>instrument-maven-plugin</artifactId>
        <version>1.0.0</version>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.13.1</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <!-- this dependency is required for instrumentation -->
        <plugin>
            <groupId>at.mana</groupId>
            <artifactId>instrument-maven-plugin</artifactId>
            <version>1.0.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>instrument-methods</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <packageList>at</packageList>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
        </plugin>

    </plugins>
</build>

Otherwise, whenever you open pom.xml file without these dependencies, MANAi will provide a notification that the project is not cappable for software energy profiling experiments.

The <package> configuration element is required. It lets you restrict search for energy experiment candidate classes residing in the specified package or one of its sub-packages.

Now you should be able to define you first energy experiment:

  • Start by creating a unit test.
  • Create a new Run Configuration, select MANA as configuration type.
  • Select sampling interval in milliseconds and the number of collected samples.
  • Execute the run configuration - when the experiment run is finished you can inspect recorded energy consumption of execcuted tests right within your source code.

Conclusion

MANAi provides an out-of-the-box solution to software energy profiling from within IntelliJ IDE. We hope that MANAi helps to support in better comprehending the energy implications of software design choices. If you are interested in contributing to MANAi or just want to share your experience using the plugin, feel free to contact me.

Currently, MANAi is primarily tailored to be used in connection with Java applications. However its modular design allow to further extend it to other languages and development environments.

License

Copyright (c) 2020 the original author or authors. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

Contributing

We are currently bringing together a contribution guide which will cover information on how you can contribute to MANAi.

manai's People

Contributors

aschuler84 avatar pointan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

ashokktripathi

manai's Issues

Refresh Method Tool Window when .mana files are changed

Currently, when .mana files are changed or deleted, the open tool window does not change accordingly. This however is not intended behavior. Whenever the file base of the .mana folder changes, also the currently opened views should change

Implement report to give overview on collected data

Once data has been collected with RAPL, the resulting data is presented in a tool window. This however limits the output to an overview table and a single-stacked bar. To gain better insights, especially into how the energy consumption evolved over time, a report with charts and tables needs to be implemented. For the sake of simplicity the report will be a pure html report which is presented in its own editor window.

Add plugin description

Provide information about the plugin and how to use it.
Include links to wiki/readme/installation guide.

Refreshing UI after energy recording fails

When RAPL is executed via respective runner, new measurement files are added to .mana folder. However, the currently registered listener fails to correctly refresh the model based on the altered files.

Communicate with Mana Cli via socket connection

Currently, the plugin relies on external created files that are processed once a full run has finished. This however, comes at the cost that the files need to be watched the whole time. To solve the mana-cli offers a socket connection which allows the plugin to obtain measurement data in realtime.

Update MANAi for new Intellij 2022.1 release

Is your feature request related to a problem? Please describe.
The current plugin descriptor prevents installing the plugin in Intellij 2022.1

Describe the solution you'd like
Update library to support current version of Intellij IDEA 2022.1

NullPointerException when starting with a selected Java-File which has no data

Describe the bug
When running the IDE and starting the new instance of IntelliJ with a project, which only has one empty Java-Class a NullPointerException pops up. Bug was seen on branch #34

To Reproduce
Steps to reproduce the behavior:

  1. Create an empty Java project and add a an empty class "Starter.java"
  2. Close the window and run the IDE again
  3. Now in the first instance of IntelliJ, a NullPointerException pops up.

Screenshots
image
image
image

Desktop

  • OS: Windows 10

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.