Page 1 of 1
Best way to time this chip?
Posted: Sun Jun 10, 2012 9:16 pm
by RichardUK
Anyone know a good way to time gl calls? I ask as I've not done this kind of timing on Linux before, in the past on other platforms I have found timing API functions can only give you a vague guess on what is costing. But even this would be handy.
If I can say 'Hi, function X is costing 100ms' to the driver guys they can then go and have a look and give a reason.
Re: Best way to time this chip?
Posted: Sun Jun 10, 2012 10:41 pm
by dave j
If this is for your glUniformMatrix4fv problem, the driver guys will want a minimal program that demonstrates the problem. That makes sure a) they can reproduce the exact circumstances that cause the problem rather than guessing what you've been trying to do and b) they have an easy way to tell if they've fixed you problem.
Searching for "linux high resolution timers" brings back lots of candidates but, as I don't have an RPi yet, I'm afraid I can't advise on the best one.
Re: Best way to time this chip?
Posted: Sun Jun 10, 2012 10:55 pm
by dom
High resolution timers are supported. gettimeofday has microsecond resolution.
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int delay = 500;
struct timeval start, stop;
if (argc > 1) delay = atoi(argv[1]);
gettimeofday(&start, NULL);
usleep(delay);
gettimeofday(&stop, NULL);
printf("Elapsed %d\n", (int)((stop.tv_sec-start.tv_sec)*1000000ULL+(stop.tv_usec-start.tv_usec)));
return 0;
}
Re: Best way to time this chip?
Posted: Mon Jun 11, 2012 1:05 pm
by RichardUK
Thanks guys, will play with this when I get home. Yes, if I do find an issue I'll make a single source file test app for the driver team.
Re: Best way to time this chip?
Posted: Sat Jul 07, 2012 2:42 pm
by devon
Re: Best way to time this chip?
Posted: Sun Jul 08, 2012 8:16 am
by jmacey
Re: Best way to time this chip?
Posted: Fri Jul 20, 2012 4:14 pm
by xernobyl
What's the fastest thing to time the RPi? The aforementioned functions which I usually use on Linux could probably be faster on a fixed platform like the RPi. There's probably a couple of registers we can peek.