Skip to content

Commit

Permalink
lib: stats-dist - Add accessor for samples
Browse files Browse the repository at this point in the history
  • Loading branch information
cmouse committed Aug 7, 2018
1 parent 4720956 commit 4bd4dac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/lib/stats-dist.c
Expand Up @@ -173,3 +173,12 @@ uint64_t stats_dist_get_percentile(const struct stats_dist *stats, double fracti
unsigned int idx = stats_dist_get_index(count, fraction);
return stats->samples[idx];
}

const uint64_t *stats_dist_get_samples(const struct stats_dist *stats,
unsigned int *count_r)
{
*count_r = (stats->count < stats->sample_count)
? stats->count
: stats->sample_count;
return stats->samples;
}
4 changes: 3 additions & 1 deletion src/lib/stats-dist.h
Expand Up @@ -34,5 +34,7 @@ static inline uint64_t stats_dist_get_95th(const struct stats_dist *stats)
{
return stats_dist_get_percentile(stats, 0.95);
}

/* Returns the sample array */
const uint64_t *stats_dist_get_samples(const struct stats_dist *stats,
unsigned int *count_r);
#endif

0 comments on commit 4bd4dac

Please sign in to comment.