Skyward boardcore
Loading...
Searching...
No Matches
CpuMeterData.h
Go to the documentation of this file.
1/* Copyright (c) 2022 Skyward Experimental Rocketry
2 * Author: Alberto Nidasio
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22
23#pragma once
24
25#include <utils/Stats/Stats.h>
26
27#include <reflect.hpp>
28
29namespace Boardcore
30{
31
33{
34 uint64_t timestamp = 0;
35 float minValue = 0;
36 float maxValue = 0;
37 float mean = 0;
38 float stdDev = 0;
39 uint32_t nSamples = 0;
40
41 uint32_t minFreeHeap = 0;
42 uint32_t freeHeap = 0;
43 uint32_t minFreeStack = 0;
44 uint32_t freeStack = 0;
45
47
48 explicit CpuMeterData(uint64_t timestamp, StatsResult stats,
49 uint32_t freeHeap, uint32_t minFreeHeap,
50 uint32_t minFreeStack, uint32_t freeStack)
52 maxValue(stats.maxValue), mean(stats.mean), stdDev(stats.stdDev),
55 {
56 }
57
58 static constexpr auto reflect()
59 {
60 return STRUCT_DEF(
62 FIELD_DEF(timestamp) FIELD_DEF(minValue) FIELD_DEF(maxValue)
63 FIELD_DEF(mean) FIELD_DEF(stdDev) FIELD_DEF(nSamples)
64 FIELD_DEF(minFreeHeap) FIELD_DEF(freeHeap)
65 FIELD_DEF(minFreeStack) FIELD_DEF(freeStack));
66 }
67};
68
69} // namespace Boardcore
Driver for the VN100S IMU.
float mean
Mean of dataset.
float stdDev
Standard deviation of dataset.
uint32_t nSamples
Number of samples.
CpuMeterData(uint64_t timestamp, StatsResult stats, uint32_t freeHeap, uint32_t minFreeHeap, uint32_t minFreeStack, uint32_t freeStack)
float maxValue
Max value found so far.
static constexpr auto reflect()
float minValue
Min value found so far.
Statistics computed by the Stats class.
Definition Stats.h:36