Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow recording interval event wthout drop guard #159

Merged
merged 2 commits into from
May 7, 2021

Conversation

Aaron1011
Copy link
Member

This makes it easier to record events when the Profiler and the
TimingGuard would need to be stored different structs.

This makes it easier to record events when the `Profiler` and the
`TimingGuard` would need to be stored different structs.
thread_id: timing.thread_id,
start_count: timing.start_count,
});
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would

let start_count = profiler.counter.since_start();
// some work
let raw_event = RawEvent::new_interval(
    event_kind,
    event_id,
    thread_id,
    start_count,
    profiler.counter.since_start(),
);
profiler.record_raw_event(&raw_event);

work if you make profiler.counter.since_start() public? That is what the drop impl of TimingGuard does.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would, but I think this API is more consistent with the existing one (hiding the underlying counter). I don't have a strong opinion, though.

measureme/src/profiler.rs Outdated Show resolved Hide resolved
measureme/src/profiler.rs Outdated Show resolved Hide resolved
@Aaron1011
Copy link
Member Author

@wesleywiser I've addressed your comments

Copy link
Member

@wesleywiser wesleywiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Aaron1011!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants