D23114: [perf] Introduce ftrace marker

Roman Gilg noreply at phabricator.kde.org
Thu Nov 14 11:01:03 GMT 2019


romangg added inline comments.

INLINE COMMENTS

> apol wrote in dbusinterface.cpp:203
> Add a warning?

I used what David proposed (DBus error message).

> davidedmundson wrote in ftrace_marker.cpp:85
> This all seems overly complex.
> 
> the presence of the file, and the function pointers are denoting the same thing
> 
> This code is basically just
> 
>   void FtraceMarker::print()
>   {
>      if (!m_file) return;
>      m_file->write(message.toLatin1());
>      m_file->flush();
>   }
>   
>   void FtraceMarker::print(ulong ctx, const QString &message)
>   {
>      print(message+ QStringLiteral(" (begin_ctx%").arg(ctx);
>   }
>   
>   void FtraceMarker::print(const QString &message, ulong ctx )
>   {
>      print(message+ QStringLiteral(" (end_ctx%").arg(ctx);
>   }
> 
> and you can strip half this class

My idea with this was that if we distribute ftrace marker calls over the code base I don't want to have an additional if conditional checking at every place if tracing is active or not but instead set function pointers that simply return in case tracing is off.

I assumed such a function call would cost less than evaluating the if-conditional. But my research later showed that this does not need to be the case.

And I know it's kind of mini optimizing anyway, so I guess we can simplify the code anyway.

REPOSITORY
  R108 KWin

REVISION DETAIL
  https://phabricator.kde.org/D23114

To: romangg, #kwin
Cc: davidedmundson, apol, zzag, kwin, LeGast00n, The-Feren-OS-Dev, sbergeron, jraleigh, fbampaloukas, GB_2, mkulinski, ragreen, jackyalcine, iodelay, crozbo, bwowk, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, hardening, romangg, jensreuterberg, abetts, sebas, ahiemstra, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwin/attachments/20191114/14560ca1/attachment-0001.html>


More information about the kwin mailing list