Hi,
On Tue, Jan 3, 2012 at 7:57 AM, Diego Biurrun <[email protected]> wrote:
> On Tue, Jan 03, 2012 at 07:40:50AM -0800, Ronald S. Bultje wrote:
>> On Tue, Jan 3, 2012 at 5:54 AM, Diego Biurrun <[email protected]> wrote:
>> > This fixes compilation failures related to START_TIMER/STOP_TIMER macros
>> > and
>> > -Werror=declaration-after-statement. START_TIMER declares variables and
>> > thus
>> > may not be placed after statements outside of a new block.
>> >
>> > --- a/libavutil/timer.h
>> > +++ b/libavutil/timer.h
>> > @@ -46,6 +46,7 @@
>> >
>> > #ifdef AV_READ_TIME
>> > #define START_TIMER \
>> > + { \
>> > uint64_t tend;\
>> > uint64_t tstart= AV_READ_TIME();\
>> >
>> > @@ -64,6 +65,7 @@ tend= AV_READ_TIME();\
>> > av_log(NULL, AV_LOG_ERROR, "%"PRIu64" decicycles in %s, %d runs,
>> > %d skips\n",\
>> > tsum*10/tcount, id, tcount, tskip_count);\
>> > }\
>> > +} \
>> > }
>> > #else
>> > #define START_TIMER
>>
>> I preferred the other idea, which is to add an INIT_TIMER macro, like:
>>
>> #define INIT_TIMER \
>> uint64_t start_time, end_time
>>
>> #define START_TIMER \
>> start_time = AV_READ_TIME()
>>
>> and STOP_TIME stays as it is.
>
> Then you have to move INIT_TIMER to somewhere far away from START_TIMER
> and use two macros (INIT_TIMER + START_TIMER) instead of just START_TIMER.
> Also, all roundabout 40 START_TIMER instances we have need to be adapted.
> How is that an improvement?
Right now, if I want to debug H264 qpel, but only mc21, I have to do this:
if (idx == mc21_idx) {
START_TIMER
qpel();
STOP_TIMER("mc21");
} else {
qpel();
}
Now I can do:
INIT_TIMER;
if (idx == mc21_idx) START_TIMER;
qpel();
if (idx == mc21_idx) STOP_TIMER("mc21");
See how much cleaner it is. I don't have to change any code anymore
(note the lack of duplicated qpel mc), and think of how much less I
have to copy code if I'm talking about >1 line of code that I'm
profiling.
Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel