Support standard deviation and json output for job stats

In the job stats, in addition to the max, min and average,
it will also display the standard deviation.

A new option --json is added to the rdci to output the results
in json format.

In the job stats, using the GMT time instead of timestamp
for start and end time.

Change-Id: If245c4fc4854a1dc867f97ff5aa9112af7962eca
This commit is contained in:
Bill(Shuzhou) Liu
2020-07-14 15:20:08 -04:00
committed by Chris Freehill
parent 9efb55b06f
commit e6d910f67a
17 changed files with 515 additions and 112 deletions
+1
View File
@@ -233,6 +233,7 @@ typedef struct {
uint64_t max_value; //!< Maximum value measured
uint64_t min_value; //!< Minimum value measured
uint64_t average; //!< Average value measured
double standard_deviation; //!< The standard deviation
} rdc_stats_summary_t;
/**
@@ -46,6 +46,15 @@ struct FieldSummaryStats {
int64_t max_value;
int64_t min_value;
int64_t total_value;
// Use Welford algorithm to calculate the standard deviations.
// https://en.wikipedia.org/wiki/Standard_deviation#Rapid_calculation_methods
// https://www.johndcook.com/blog/standard_deviation/
double old_m;
double old_s;
double new_m;
double new_s;
uint64_t last_time;
uint64_t count;
};
@@ -100,6 +109,8 @@ class RdcCacheManagerImpl: public RdcCacheManager {
void set_summary(const FieldSummaryStats & stats,
rdc_stats_summary_t& gpu, rdc_stats_summary_t& summary, // NOLINT
unsigned int adjuster);
void set_average_summary(
rdc_stats_summary_t& summary, uint32_t num_gpus); // NOLINT
RdcCacheSamples cache_samples_;
RdcJobStatsCache cache_jobs_;
std::mutex cache_mutex_;