AAU Student Projects - visit Aalborg University's student projects portal
A master's thesis from Aalborg University
Book cover


Energy measurements of tests: Exploring the energy consumption of tests in C# using Intel RAPL

Authors

;

Term

4. term

Education

Publication year

2022

Submitted on

Pages

82

Abstract

There is growing attention to energy use. This report explores how to measure energy consumption during software tests and make these measurements part of Continuous Integration (CI), where code is automatically built and tested. We integrate energy measurements into the MSTest framework. Along the way, we find that measurements are often noisy, so we examine the limitations of Intel RAPL with respect to sampling rate. Based on this, we establish a minimum test duration to obtain stable readings. We demonstrate the approach on unit tests in the Newtonsoft.JSON framework with two scenarios: integer serialization and path traversal. We are able to measure the energy use of tests and detect differences in both energy consumption and runtime across code changes. Our contribution is a practical method for measuring changes in test energy usage and guidance on how small/short tests can be measured reliably using Intel RAPL.

Der er et stigende fokus på energiforbrug. Denne rapport undersøger, hvordan man kan måle energiforbrug under softwaretests og gøre disse målinger til en del af Continuous Integration (CI), hvor kode automatisk bygges og testes. Vi integrerer energimålinger i testframeworket MSTest. Undervejs finder vi, at målinger ofte er unøjagtige, og vi undersøger derfor begrænsningerne i Intel RAPL med hensyn til sample-hastighed. På den baggrund fastlægger vi en minimumsvarighed for tests, så målingerne bliver stabile. Vi demonstrerer metoden på enhedstests i Newtonsoft.JSON-frameworket med to scenarier: heltals-serialisering og gennemløb af stier (path traversal). Vi kan måle energiforbruget for tests og opdage forskelle i både energiforbrug og køretid på tværs af kodeændringer. Vores bidrag er en praktisk metode til at måle ændringer i testenes energiforbrug samt vejledning i, hvordan små/korte tests kan måles pålideligt med Intel RAPL.

[This apstract has been rewritten with the help of AI based on the project's original abstract]