aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/debug/stats.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lib/debug/stats.cc')
-rw-r--r--src/core/lib/debug/stats.cc36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/core/lib/debug/stats.cc b/src/core/lib/debug/stats.cc
index 4096384dd9..b32cf19028 100644
--- a/src/core/lib/debug/stats.cc
+++ b/src/core/lib/debug/stats.cc
@@ -27,18 +27,18 @@
#include "src/core/lib/support/string.h"
-grpc_stats_data *grpc_stats_per_cpu_storage = NULL;
+grpc_stats_data* grpc_stats_per_cpu_storage = NULL;
static size_t g_num_cores;
void grpc_stats_init(void) {
g_num_cores = GPR_MAX(1, gpr_cpu_num_cores());
grpc_stats_per_cpu_storage =
- (grpc_stats_data *)gpr_zalloc(sizeof(grpc_stats_data) * g_num_cores);
+ (grpc_stats_data*)gpr_zalloc(sizeof(grpc_stats_data) * g_num_cores);
}
void grpc_stats_shutdown(void) { gpr_free(grpc_stats_per_cpu_storage); }
-void grpc_stats_collect(grpc_stats_data *output) {
+void grpc_stats_collect(grpc_stats_data* output) {
memset(output, 0, sizeof(*output));
for (size_t core = 0; core < g_num_cores; core++) {
for (size_t i = 0; i < GRPC_STATS_COUNTER_COUNT; i++) {
@@ -52,8 +52,8 @@ void grpc_stats_collect(grpc_stats_data *output) {
}
}
-void grpc_stats_diff(const grpc_stats_data *b, const grpc_stats_data *a,
- grpc_stats_data *c) {
+void grpc_stats_diff(const grpc_stats_data* b, const grpc_stats_data* a,
+ grpc_stats_data* c) {
for (size_t i = 0; i < GRPC_STATS_COUNTER_COUNT; i++) {
c->counters[i] = b->counters[i] - a->counters[i];
}
@@ -62,13 +62,13 @@ void grpc_stats_diff(const grpc_stats_data *b, const grpc_stats_data *a,
}
}
-int grpc_stats_histo_find_bucket_slow(grpc_exec_ctx *exec_ctx, int value,
- const int *table, int table_size) {
+int grpc_stats_histo_find_bucket_slow(grpc_exec_ctx* exec_ctx, int value,
+ const int* table, int table_size) {
GRPC_STATS_INC_HISTOGRAM_SLOW_LOOKUPS(exec_ctx);
- const int *const start = table;
+ const int* const start = table;
while (table_size > 0) {
int step = table_size / 2;
- const int *it = table + step;
+ const int* it = table + step;
if (value >= *it) {
table = it + 1;
table_size -= step + 1;
@@ -79,7 +79,7 @@ int grpc_stats_histo_find_bucket_slow(grpc_exec_ctx *exec_ctx, int value,
return (int)(table - start) - 1;
}
-size_t grpc_stats_histo_count(const grpc_stats_data *stats,
+size_t grpc_stats_histo_count(const grpc_stats_data* stats,
grpc_stats_histograms histogram) {
size_t sum = 0;
for (int i = 0; i < grpc_stats_histo_buckets[histogram]; i++) {
@@ -88,8 +88,8 @@ size_t grpc_stats_histo_count(const grpc_stats_data *stats,
return sum;
}
-static double threshold_for_count_below(const gpr_atm *bucket_counts,
- const int *bucket_boundaries,
+static double threshold_for_count_below(const gpr_atm* bucket_counts,
+ const int* bucket_boundaries,
int num_buckets, double count_below) {
double count_so_far;
double lower_bound;
@@ -119,13 +119,13 @@ static double threshold_for_count_below(const gpr_atm *bucket_counts,
should lie */
lower_bound = bucket_boundaries[lower_idx];
upper_bound = bucket_boundaries[lower_idx + 1];
- return upper_bound -
- (upper_bound - lower_bound) * (count_so_far - count_below) /
- (double)bucket_counts[lower_idx];
+ return upper_bound - (upper_bound - lower_bound) *
+ (count_so_far - count_below) /
+ (double)bucket_counts[lower_idx];
}
}
-double grpc_stats_histo_percentile(const grpc_stats_data *stats,
+double grpc_stats_histo_percentile(const grpc_stats_data* stats,
grpc_stats_histograms histogram,
double percentile) {
size_t count = grpc_stats_histo_count(stats, histogram);
@@ -136,9 +136,9 @@ double grpc_stats_histo_percentile(const grpc_stats_data *stats,
grpc_stats_histo_buckets[histogram], (double)count * percentile / 100.0);
}
-char *grpc_stats_data_as_json(const grpc_stats_data *data) {
+char* grpc_stats_data_as_json(const grpc_stats_data* data) {
gpr_strvec v;
- char *tmp;
+ char* tmp;
bool is_first = true;
gpr_strvec_init(&v);
gpr_strvec_add(&v, gpr_strdup("{"));