rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
histogram.h
Go to the documentation of this file.
1/**
2 * @file histogram.h
3 * @brief This data structure is used to analyze CPU performance
4 *
5 * User can report data into a histogram and later get an aggregated represenation, i.e.
6 * a histogram, of these values.
7 *
8 * A typicsl use-case would be reporting the times it took to execure a particular section of
9 * code - and later analyzing the histogram.
10 *
11 *
12 * @date Dec 18, 2013
13 * @author Andrey Belomutskiy, (c) 2012-2020
14 */
15
16#pragma once
17
18#ifdef __cplusplus
19extern "C"
20{
21#endif /* __cplusplus */
22
23#include <stdint.h>
24
25#define BOUND_LENGTH 895
26
27typedef struct {
28 char name[16];
29 int64_t total_value;
30 int64_t total_count;
31 int values[BOUND_LENGTH];
33
34void initHistogramsModule(void);
35int histogramGetIndex(int64_t value);
36void initHistogram(histogram_s *h, const char *name);
37void hsAdd(histogram_s *h, int64_t value);
38int hsReport(histogram_s *h, int* report);
39
40#ifdef __cplusplus
41}
42#endif /* __cplusplus */
int histogramGetIndex(int64_t value)
This internal method is only public so that we can test it.
Definition histogram.cpp:66
void initHistogram(histogram_s *h, const char *name)
Reset histogram_s to orignal state.
Definition histogram.cpp:89
void hsAdd(histogram_s *h, int64_t value)
int hsReport(histogram_s *h, int *report)
Prepare histogram report.
void initHistogramsModule(void)
Definition histogram.cpp:44
int64_t total_value
Definition histogram.h:29
int64_t total_count
Definition histogram.h:30