This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Array handling question


Hi,

I have troubles to get what I want from linetimes.stp example, so I've decided to create my own somewhat simplified version. I'm currently interested in the average runtime of a function after a certain number of runs, but apparently it gives me values like 74279383992077, which is clearly wrong. And I have a feeling I'm misunderstanding something obvious about the array handling, but I couldn't figure out what.
Could anyone give me an advice about what am I missing?

Regards,

Zoltan Kiss

And here is my example script:

global cnt = 0;
global starttime = 0;
global runtimes;

probe process(<procname>).function(<funcname>).call {
        starttime = gettimeofday_ns();
}

probe process(<procname>).function(<funcname>).return {
	runtime = gettimeofday_ns() - starttime;
	starttime = 0;
	runtimes <<< runtime;
	if (cnt > 50000) {
		printf("Runtime avg: %u\n", @avg(runtimes));
		delete runtimes;
		cnt = 0;
	}
	cnt++;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]