Re: [PATCH v5 10/11] trace: add trace_performance facility to debug performance issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 17.06.2014 19:11, schrieb Junio C Hamano:
> Karsten Blees <karsten.blees@xxxxxxxxx> writes:
> 
>> Simple use case (measure one code section):
>>
>>   uint64_t start = getnanotime();
>>   /* code section to measure */
>>   trace_performance_since(start, "foobar");
>>
>> Medium use case (measure consecutive code sections):
>>
>>   uint64_t start = getnanotime();
>>   /* first code section to measure */
>>   start = trace_performance_since(start, "first foobar");
>>   /* second code section to measure */
>>   trace_performance_since(start, "second foobar");
>>
>> Complex use case (measure repetitive code sections):
>>
>>   uint64_t t = 0;
>>   for (;;) {
>>     /* ignore */
>>     t -= getnanotime();
>>     /* code section to measure */
>>     t += getnanotime();
>>     /* ignore */
>>   }
>>   trace_performance(t, "frotz");
> 
> Hmph.  Even though trace_performance() makes an extra call to
> getnanotime() in order to return, examples do not use the returned
> value?  The second example is a good illustration why it makes sense
> for trace_performance_since(), though.
> 

Right, it makes no sense for trace_performance(), and for
trace_performance_since() only if followed by another 'measured' code
section. In that special case, I think it wouldn't hurt if you had to
write:

  uint64_t start = getnanotime();
  /* first code section to measure */
  trace_performance_since(start, "first foobar");

  start = getnanotime();
  /* second code section to measure */
  trace_performance_since(start, "second foobar");

So I guess I'll drop the return value (and the second example, which
is then redundant to the first).

>> +static void trace_performance_vfl(const char *file, int line,
>> +				      uint64_t nanos, const char *format,
>> +				      va_list ap)
>> +{
> 
> Just being curious, but what does "v" stand for?
> 

trace_performance_vfl(, va_list)
vs.
trace_performance_fl(, ...)

Will change to trace_performance_vprintf_fl()

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]