Support logging elapsed time on tracers#1186
Merged
anoop-sysd merged 1 commit intodevfrom Aug 3, 2018
Merged
Conversation
Apart from having the tracers in the first place, allow setting a timeout, after which we log a message to bring our attention to the problem in the first place.
mstemm
reviewed
Aug 2, 2018
| tracer_emitter::tracer_emitter(std::string tag) | ||
| tracer_emitter::tracer_emitter(std::string tag, uint64_t timeout_ns) | ||
| : m_tag(std::move(tag)) | ||
| , m_start_ns(sinsp_utils::get_current_time_ns()) |
Contributor
There was a problem hiding this comment.
I think it would be good to allow providing an external timestamp for now. I remember in the past where lots of calls to sinsp_utils::get_current_time_ns() ended up being expensive.
|
|
||
| uint64_t tracer_emitter::elapsed_time() const | ||
| { | ||
| auto elapsed = sinsp_utils::get_current_time_ns() - m_start_ns; |
Contributor
There was a problem hiding this comment.
Ditto on externally provided time, although you may only be able to specify it when explicitly calling stop().
anoop-sysd
approved these changes
Aug 2, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Apart from having the tracers in the first place, allow setting
a timeout, after which we log a message to bring our attention
to the problem in the first place.