summaryrefslogtreecommitdiffstats
path: root/runtime/stat-common.c
diff options
context:
space:
mode:
authorhunt <hunt>2005-11-08 19:48:23 +0000
committerhunt <hunt>2005-11-08 19:48:23 +0000
commit7ba70af105ed918b5b07e5bba8b5d27a8d911249 (patch)
treeb33bcea26aa98488bfa987a62764837ae0c39bad /runtime/stat-common.c
parent4893e4b2858af12d916c3915a97336cdb0c8236b (diff)
downloadsystemtap-steved-7ba70af105ed918b5b07e5bba8b5d27a8d911249.tar.gz
systemtap-steved-7ba70af105ed918b5b07e5bba8b5d27a8d911249.tar.xz
systemtap-steved-7ba70af105ed918b5b07e5bba8b5d27a8d911249.zip
2005-11-08 Martin Hunt <hunt@redhat.com>
* map.c (_stp_map_init): New function. Extracted from _stp_map_new() so it can be used in _stp_pmap_new(). (_stp_map_new): Call _stp_map_init(). (_stp_pmap_new): New function. (_stp_pmap_new_hstat_linear): New function. (_stp_pmap_new_hstat_log): New function. (_stp_pmap_del): New function. (_stp_pmap_printn_cpu): New function. (_stp_pmap_printn): New function. (_stp_new_agg): New function. (_stp_add_agg): New function. (_stp_pmap_agg): New function. (_new_map_clear_node): New function. * map.h (struct map_root): Add Hist struct. Add copy and cmp function pointers for pmaps. * stat.h: Remove Stat struct. Replace with Hist struct that is limited to only histogram params. * map-stat.c: Fix up references to histogram params in map_root. * stat-common.c: Ditto. * stat.c: Ditto. * pmap-gen.c: New file. Implements per-cpu maps. * map-gen.c: Minor bug fixes. Use new VAL_IS_ZERO() macro. * alloc.c (vmalloc_node): For NUMA, provide a vmalloc that does node-local allocations. (_stp_alloc_cpu): A version of _stp_alloc() that does node-local allocations. (_stp_valloc): A version of _stp_valloc() that does node-local allocations. (__stp_valloc_percpu): New function. Like alloc_percpu() except uses _stp_valloc(). (_stp_vfree_percpu): New function. Like free_percpu().
Diffstat (limited to 'runtime/stat-common.c')
-rw-r--r--runtime/stat-common.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/runtime/stat-common.c b/runtime/stat-common.c
index 86a7b79b..aa30641e 100644
--- a/runtime/stat-common.c
+++ b/runtime/stat-common.c
@@ -96,16 +96,16 @@ static int msb64(int64_t val)
#define HIST_WIDTH 50
#endif
-static void _stp_stat_print_histogram (Stat st, stat *sd)
+static void _stp_stat_print_histogram (Hist st, stat *sd)
{
int scale, i, j, val_space, cnt_space;
int64_t val, v, max = 0;
- if (st->hist_type != HIST_LOG && st->hist_type != HIST_LINEAR)
+ if (st->type != HIST_LOG && st->type != HIST_LINEAR)
return;
/* get the maximum value, for scaling */
- for (i = 0; i < st->hist_buckets; i++)
+ for (i = 0; i < st->buckets; i++)
if (sd->histogram[i] > max)
max = sd->histogram[i];
@@ -119,10 +119,10 @@ static void _stp_stat_print_histogram (Stat st, stat *sd)
}
cnt_space = needed_space (max);
- if (st->hist_type == HIST_LINEAR)
- val_space = needed_space (st->hist_start + st->hist_int * (st->hist_buckets - 1));
+ if (st->type == HIST_LINEAR)
+ val_space = needed_space (st->start + st->interval * (st->buckets - 1));
else
- val_space = needed_space (1 << (st->hist_buckets - 1));
+ val_space = needed_space (1 << (st->buckets - 1));
//dbug ("max=%lld scale=%d val_space=%d\n", max, scale, val_space);
/* print header */
@@ -137,11 +137,11 @@ static void _stp_stat_print_histogram (Stat st, stat *sd)
reprint (HIST_WIDTH, "-");
_stp_print_cstr (" count\n");
_stp_print_flush();
- if (st->hist_type == HIST_LINEAR)
- val = st->hist_start;
+ if (st->type == HIST_LINEAR)
+ val = st->start;
else
val = 0;
- for (i = 0; i < st->hist_buckets; i++) {
+ for (i = 0; i < st->buckets; i++) {
reprint (val_space - needed_space(val), " ");
_stp_printf("%d", val);
_stp_print_cstr (" |");
@@ -153,8 +153,8 @@ static void _stp_stat_print_histogram (Stat st, stat *sd)
reprint (v, "@");
reprint (HIST_WIDTH - v + 1 + cnt_space - needed_space(sd->histogram[i]), " ");
_stp_printf ("%lld\n", sd->histogram[i]);
- if (st->hist_type == HIST_LINEAR)
- val += st->hist_int;
+ if (st->type == HIST_LINEAR)
+ val += st->interval;
else if (val == 0)
val = 1;
else
@@ -162,7 +162,7 @@ static void _stp_stat_print_histogram (Stat st, stat *sd)
}
}
-static void _stp_stat_print_valtype (char *fmt, Stat st, struct stat_data *sd, int cpu)
+static void _stp_stat_print_valtype (char *fmt, Hist st, stat *sd, int cpu)
{
switch (*fmt) {
case 'C':
@@ -195,7 +195,7 @@ static void _stp_stat_print_valtype (char *fmt, Stat st, struct stat_data *sd, i
}
}
-static void __stp_stat_add (Stat st, struct stat_data *sd, int64_t val)
+static void __stp_stat_add (Hist st, stat *sd, int64_t val)
{
int n;
if (sd->count == 0) {
@@ -209,21 +209,21 @@ static void __stp_stat_add (Stat st, struct stat_data *sd, int64_t val)
if (val < sd->min)
sd->min = val;
}
- switch (st->hist_type) {
+ switch (st->type) {
case HIST_LOG:
n = msb64 (val);
- if (n >= st->hist_buckets)
- n = st->hist_buckets - 1;
+ if (n >= st->buckets)
+ n = st->buckets - 1;
sd->histogram[n]++;
break;
case HIST_LINEAR:
- val -= st->hist_start;
- do_div (val, st->hist_int);
+ val -= st->start;
+ do_div (val, st->interval);
n = val;
if (n < 0)
n = 0;
- if (n >= st->hist_buckets)
- n = st->hist_buckets - 1;
+ if (n >= st->buckets)
+ n = st->buckets - 1;
sd->histogram[n]++;
default:
break;