RE: proposal for ICU tracing

"Carl W. Brown" <[email protected]>
Newsgroups gmane.comp.lib.icu.general
Message-ID <[email protected]>
Andy,

> Carl W. Brown wrote:
>  > There is a solution and that is to use thread local storage.  I have
>
> [Suggests the use of thread local storage to allow tracing of the
> activity of individual threads in ICU]
>
> I can certainly see how this would be useful for multi-threaded
> environments.  Without some threading help, traces from a multithreaded
> app would show overlapped ICU usage from the various threads, which
> could be quite confusing.

Global events would be more confusing becasue they would have no thread
unique information to be able to distinguish them.  If you want the trace a
specific piece of code you can not just have one thread enable a global
switch and another thread disable it.  The events will also be intermixed
and very confusing and you will have no idea of the proper sequencing.

If we find that we need state information within ICU then global will not
work.

If you are doing functionsl wall timing the start stop times have to be
thread based.
>
> I am, however, reluctant to add a dependency on thread local storage to
> the core tracing code.  I would also want to verify that the time to
> access a TLS tracing flag was not notably different from the time to
> access a simple global tracing flag.

Accessing TLS is relativly fast.  The storage pointer is switched at task
switch so it is much like accessing a structure from static storage.  If no
TLS then no trace.  If TLS then test the trace switch.

> The good news is that the global tracing functions are user/application
> code, and could easily filter based on thread if that is needed.

I don't know how effective global tracing will be in a multi-threaded
environment.  If you do not have a multithreaded environment that there is
no extra overhead becasue the structure containing the switch is in static
storage.

I think that TLS will improve ICU performance with locale handeling.  This
will more than offset any tracing overhead.  It can fall back to the current
method or skip locale handeling if TLS is enabled by the application and the
locale is unchanged.  I am sure that we can find other uses for TLS in ICU
as well.

Carl
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.