Commit b4436b06 authored by Daniel Friesel's avatar Daniel Friesel
Browse files

--histogram: Add duration and power plots

parent 30d7cc1b
Loading
Loading
Loading
Loading
+21 −4
Original line number Diff line number Diff line
@@ -117,9 +117,12 @@ OPTIONS
  --stat
    Print mean voltage, current, and power as well as total energy consumption.
  --histogram=<n>
    Draw histogram of reported energy values per measurement interval
    (i.e., the differences between each pair of consecutive total energy readings)
    using <n> buckets.
    Draw histograms of reported energy values per measurement interval
    (i.e., the differences between each pair of consecutive total energy readings),
    measurement interval duration, and
    mean power values per measurement interval
    (calculated from energy difference and duration).
    Each histogram uses <n> buckets.

DEPENDENCIES

@@ -385,5 +388,19 @@ if __name__ == "__main__":
        plt.show()

    if "histogram" in opt:
        plt.hist((data[1:, 3] - data[:-1, 3]) * 1e-9, bins=int(opt["histogram"]))
        bin_count = int(opt["histogram"])

        plt.xlabel("Reported Energy per Measurement Interval [J]")
        plt.ylabel("Count")
        plt.hist((data[1:, 3] - data[:-1, 3]) * 1e-9, bins=bin_count)
        plt.show()

        plt.xlabel("Measurement Interval Duration [s]")
        plt.ylabel("Count")
        plt.hist((data[1:, 0] - data[:-1, 0]) * 1e-6, bins=bin_count)
        plt.show()

        plt.xlabel("Mean Power per Measurement Interval [W]")
        plt.ylabel("Count")
        plt.hist(power_from_energy, bins=bin_count)
        plt.show()