Skip to main content

An energy consumption measuring and reporting tool

Project description

Scenario Energy Report

Authors: Delano Flipse, Rodin Haker, Aron Hoogeveen

Setup

This project uses Python 3.10.

Description

Usage

There are two main ways to use this project:

  1. Use the decorator to test a function. You can proved the amount of times it has to run as a parameter.
@EnergyTest.energy_test(2)
def test_func():
    def fib(n):
        if n <= 1:
            return n
        else:
            return fib(n-1) + fib(n-2)

    assert fib(37) == 24157817, "Not equal"
  1. Use a with statement to test a particular piece of code once
def test_func3():
    with EnergyTest() as test:
        def fib(n):
            if n <= 1:
                return n
            else:
                return fib(n-1) + fib(n-2)

        assert fib(35) == 9227465, "Not equal"

You can set up the following custom parameters:

  • model
  • report name
  • report description
  • whether to save a report (in JSON format)
EnergyTest().set_model(EnergyModel)
EnergyTest().set_report_name("Custom Report Name")
EnergyTest().set_report_description("Custom Report Description")
EnergyTest().set_save_report(True)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

energy_consumption_reporter-0.1.1.tar.gz (3.2 MB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page