From 98ec387a8443f7185814715175c4c0d86390c9b6 Mon Sep 17 00:00:00 2001 From: hunt Date: Wed, 25 Jan 2006 09:15:15 +0000 Subject: 2006-01-25 Martin Hunt * stat.c (_stp_stat_init): Use _stp_alloc_percpu(). (_stp_stat_del): New function. * alloc.c (_stp_alloc_percpu): New function. (_stp_free_percpu): New function. --- runtime/stat.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'runtime/stat.c') diff --git a/runtime/stat.c b/runtime/stat.c index 29dcef9b..d9eff2c3 100644 --- a/runtime/stat.c +++ b/runtime/stat.c @@ -101,7 +101,7 @@ Stat _stp_stat_init (int type, ...) return NULL; size = buckets * sizeof(int64_t) + sizeof(stat); - sd = (stat *) __alloc_percpu (size, 8); + sd = (stat *) _stp_alloc_percpu (size); if (sd == NULL) goto exit1; @@ -135,6 +135,20 @@ exit1: return NULL; } +/** Delete Stat. + * Call this to free all memory allocated during initialization. + * + * @param st Stat + */ +void _stp_stat_del (Stat st) +{ + if (st) { + _stp_free_percpu (st->sd); + kfree (st->agg); + kfree (st); + } +} + /** Add to a Stat. * Add an int64 to a Stat. * -- cgit