llogiq / flame

An intrusive flamegraph profiling tool for rust.
Apache License 2.0
694 stars 30 forks source link

Replace clock_ticks with std::time #12

Closed serprex closed 8 years ago

serprex commented 8 years ago

Instant is currently grabbed in thread_local init of Library. If it's desirable to share Instant then a write-once read-many global could be used for the epoch

Developing through github, feel free to squash

llogiq commented 8 years ago

Before we merge it, I'd like to see an benchmark where multiple threads stress the time handling – I have a hunch that the thread-local implementation will be faster in that case because it avoids synchronization (which can become a bottleneck).

Note that we are usually interested in the performance of the highly-contended hot areas of the code, so anything that synchronizes them in any way should be avoided.

serprex commented 8 years ago

This PR doesn't implement a shared epoch currently. Should I take your desire for a contended epoch benchmark to imply that this PR should implement a shared epoch?

TyOverby commented 8 years ago

@Tomaka's clock ticks library already uses std::time under the hood, so I'll merge this now and the conversation about synchronization can continue.

@llogiq Where are you seeing synchronization?