lintel icon indicating copy to clipboard operation
lintel copied to clipboard

Profile video loading and decoding performance

Open ZaidQureshi opened this issue 7 years ago • 1 comments

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.

ZaidQureshi avatar Jun 14 '18 20:06 ZaidQureshi

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.

dukebw avatar Jun 20 '18 14:06 dukebw