mirror of
				https://github.com/tiagovignatti/intel-gpu-tools.git
				synced 2025-11-04 12:07:12 +00:00 
			
		
		
		
	stats: Be more precise and talk about mean, not average
There are several types of averages eg. mean, median and mode. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
This commit is contained in:
		
							parent
							
								
									e86557ca9f
								
							
						
					
					
						commit
						e55a11d3eb
					
				@ -44,7 +44,7 @@ void igt_stats_push(igt_stats_t *stats, uint64_t value)
 | 
			
		||||
	stats->values[stats->n_values++] = value;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
double igt_stats_get_average(igt_stats_t *stats)
 | 
			
		||||
double igt_stats_get_mean(igt_stats_t *stats)
 | 
			
		||||
{
 | 
			
		||||
	unsigned int i;
 | 
			
		||||
	double a = 0.0;
 | 
			
		||||
 | 
			
		||||
@ -33,4 +33,4 @@ typedef struct {
 | 
			
		||||
void igt_stats_init(igt_stats_t *stats, unsigned int capacity);
 | 
			
		||||
void igt_stats_fini(igt_stats_t *stats);
 | 
			
		||||
void igt_stats_push(igt_stats_t *stats, uint64_t value);
 | 
			
		||||
double igt_stats_get_average(igt_stats_t *stats);
 | 
			
		||||
double igt_stats_get_mean(igt_stats_t *stats);
 | 
			
		||||
 | 
			
		||||
@ -25,10 +25,10 @@
 | 
			
		||||
#include "igt_core.h"
 | 
			
		||||
#include "igt_stats.h"
 | 
			
		||||
 | 
			
		||||
static void test_average(void)
 | 
			
		||||
static void test_mean(void)
 | 
			
		||||
{
 | 
			
		||||
	igt_stats_t stats;
 | 
			
		||||
	double average;
 | 
			
		||||
	double mean;
 | 
			
		||||
 | 
			
		||||
	igt_stats_init(&stats, 5);
 | 
			
		||||
 | 
			
		||||
@ -38,12 +38,12 @@ static void test_average(void)
 | 
			
		||||
	igt_stats_push(&stats, 8);
 | 
			
		||||
	igt_stats_push(&stats, 10);
 | 
			
		||||
 | 
			
		||||
	average = igt_stats_get_average(&stats);
 | 
			
		||||
	mean = igt_stats_get_mean(&stats);
 | 
			
		||||
 | 
			
		||||
	igt_assert(average == (2 + 4 + 6 + 8 + 10) / 5.);
 | 
			
		||||
	igt_assert(mean == (2 + 4 + 6 + 8 + 10) / 5.);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
igt_simple_main
 | 
			
		||||
{
 | 
			
		||||
	test_average();
 | 
			
		||||
	test_mean();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -917,7 +917,8 @@ static void test_run(struct test_ops *test)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	printf("even/odd dividers: %d/%d\n", p_odd_even[0], p_odd_even[1]);
 | 
			
		||||
	printf("average deviation: %.2lf\n", igt_stats_get_average(&stats));
 | 
			
		||||
	printf("mean central freq deviation: %.2lf\n",
 | 
			
		||||
	       igt_stats_get_mean(&stats));
 | 
			
		||||
 | 
			
		||||
	igt_stats_fini(&stats);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user