lintel
lintel copied to clipboard
Profile video loading and decoding performance
I would like to get a split of time spent in reading data from disk (io) and time spent in the actual decoding. How do you suggest I go about doing this? Thanks.
Hi Zaid, all of the Lintel APIs assume you have already read encoded video into memory, e.g., via calling f = open() then f.read(). So determining how much time is spent in I/O vs. decoding would depend on how you are loading your encoded video examples.
In terms of profiling how long decoding takes, you could use some code like this:
/**
* get_elapsed_sec() - Returns the elapsed time in seconds since `start`, until
* `end`.
*/
static double
get_elapsed_sec(struct timeval start, struct timeval end)
{
return ((end.tv_sec - start.tv_sec) +
(end.tv_usec - start.tv_usec)/1e6);
}
Along with gettimeofday from <sys/time.h>, and stick these in https://github.com/dukebw/lintel/blob/master/lintel/py_ext/lintelmodule.c at the appropriate places.