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.
Best way to time this chip?
7 posts
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.
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.
- Posts: 32
- Joined: Mon Mar 05, 2012 2:19 pm
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;
}
#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;
}
- Moderator
- Posts: 3229
- Joined: Wed Aug 17, 2011 7:41 pm
- Location: Cambridge
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.
- Posts: 5
- Joined: Wed Jun 13, 2012 4:43 pm
I usually use the boost timers http://www.boost.org/doc/libs/1_50_0/doc/html/date_time.html
There is a particularly good cpu timer class http://www.boost.org/doc/libs/1_48_0/libs/timer/doc/cpu_timers.html
There is a particularly good cpu timer class http://www.boost.org/doc/libs/1_48_0/libs/timer/doc/cpu_timers.html
- Posts: 135
- Joined: Thu May 31, 2012 1:05 pm
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.
- Posts: 26
- Joined: Tue Oct 25, 2011 2:03 pm