Re: [RFC] [PATCH] Scalable Statistics Counters

Dipankar Sarma (dipankar@in.ibm.com)
Wed, 5 Dec 2001 21:09:38 +0530


Hi Rik,

On Wed, Dec 05, 2001 at 11:13:19AM -0200, Rik van Riel wrote:
> On Wed, 5 Dec 2001, Ravikiran G Thirumalai wrote:
>
> > Here is a RFC for Scalable Statistics Counters.
>
> > Initial results of micro benchmarking on 3 cpus showed a 65% reduction
> > in cpu cycles used to update the proposed statistics counter, over
> > global non atomic counter.
>
> I'd use it, if there were a really easy interface to the thing.
>
> This would include both an interface to automagically use it from
> the routines where we increase variables to some automagic reporting
> in /proc ;)

Which interfaces would you consider complicated ?

I guess currently one would do -

struct yyy {
int blah1;
void *blah2;
int stats;
};

void some_init_routine(struct another_struct *op)
{
op->yyy = kmalloc(sizeof(struct yyy), GFP_KERNEL);
if (op->yyy == NULL)
return;
memset(op->yyy, 0, sizeof(struct yyy));
}

void do_something(struct another_struct *op)
{
op->yyy.stats++;
}

int get_stats(struct another_struct *op)
{
return op->yyy.stats;
}

statctr just provides interfaces to do all these three operations.
Did I miss something here ?

What would be your ideal way of using a statistics counter ?

>
> (it'd be so cool if we could just start using a statistic variable
> through some macro and it'd be automatically declared and visible
> in /proc ;))
>

Given a parent /proc directory, it would be possible for statctr to
automatically create corresponding proc entries and automatically
reflect the combined per-cpu counter value.
However if you want to club multiple statctrs together in
a single /proc entry, then it gets complicated and it might
just be easier for the driver to maintain its proc entries.

Thanks
Dipankar

-- 
Dipankar Sarma  <dipankar@in.ibm.com> http://lse.sourceforge.net
Linux Technology Center, IBM Software Lab, Bangalore, India.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/