D23114: [perf] Introduce ftrace marker

Roman Gilg <[email protected]>
Newsgroups gmane.comp.kde.devel.kwin
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.