Go to the documentation of this file.
29 #include "absl/strings/str_format.h"
30 #include "absl/strings/str_join.h"
65 c->counters[
i] =
b->counters[
i] -
a->counters[
i];
68 c->histograms[
i] =
b->histograms[
i] -
a->histograms[
i];
76 while (table_size > 0) {
77 int step = table_size / 2;
81 table_size -=
step + 1;
93 sum +=
static_cast<size_t>(
100 const int* bucket_boundaries,
101 int num_buckets,
double count_below) {
110 for (lower_idx = 0; lower_idx < num_buckets; lower_idx++) {
111 count_so_far +=
static_cast<double>(bucket_counts[lower_idx]);
112 if (count_so_far >= count_below) {
116 if (count_so_far == count_below) {
119 for (upper_idx = lower_idx + 1; upper_idx < num_buckets; upper_idx++) {
120 if (bucket_counts[upper_idx]) {
124 return (bucket_boundaries[lower_idx] + bucket_boundaries[upper_idx]) / 2.0;
128 lower_bound = bucket_boundaries[lower_idx];
129 upper_bound = bucket_boundaries[lower_idx + 1];
130 return upper_bound - (upper_bound - lower_bound) *
131 (count_so_far - count_below) /
132 static_cast<double>(bucket_counts[lower_idx]);
140 if (
count == 0)
return 0.0;
149 std::vector<std::string> parts;
150 parts.push_back(
"{");
168 parts.push_back(
"]");
170 parts.push_back(
"}");
GPRAPI unsigned gpr_cpu_num_cores(void)
grpc_stats_data * grpc_stats_per_cpu_storage
#define gpr_atm_no_barrier_load(p)
return memset(p, 0, total)
ABSL_MUST_USE_RESULT std::string StrFormat(const FormatSpec< Args... > &format, const Args &... args)
const int grpc_stats_histo_buckets[13]
@ GRPC_STATS_HISTOGRAM_COUNT
double sum(const T &container, F functor)
std::string grpc_stats_data_as_json(const grpc_stats_data *data)
static double threshold_for_count_below(const gpr_atm *bucket_counts, const int *bucket_boundaries, int num_buckets, double count_below)
const char * grpc_stats_counter_name[GRPC_STATS_COUNTER_COUNT]
def percentile(N, percent, key=lambda x:x)
GPRAPI void gpr_once_init(gpr_once *once, void(*init_function)(void))
GPRAPI void * gpr_zalloc(size_t size)
static size_t g_num_cores
size_t grpc_stats_histo_count(const grpc_stats_data *stats, grpc_stats_histograms histogram)
std::string StrJoin(Iterator start, Iterator end, absl::string_view sep, Formatter &&fmt)
void grpc_stats_init(void)
int grpc_stats_histo_find_bucket_slow(int value, const int *table, int table_size)
static grpc_histogram * histogram
const int grpc_stats_histo_start[13]
void grpc_stats_collect(grpc_stats_data *output)
const char * grpc_stats_histogram_name[GRPC_STATS_HISTOGRAM_COUNT]
@ GRPC_STATS_HISTOGRAM_BUCKETS
double grpc_stats_histo_percentile(const grpc_stats_data *stats, grpc_stats_histograms histogram, double percentile)
#define GRPC_STATS_INC_HISTOGRAM_SLOW_LOOKUPS()
void grpc_stats_diff(const grpc_stats_data *b, const grpc_stats_data *a, grpc_stats_data *c)
@ GRPC_STATS_COUNTER_COUNT
const int *const grpc_stats_histo_bucket_boundaries[13]
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:22