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

Add some way to clear storage #138

Open
LGoossens opened this issue Jul 19, 2021 · 3 comments
Open

Add some way to clear storage #138

LGoossens opened this issue Jul 19, 2021 · 3 comments

Comments

@LGoossens
Copy link

Use case:
On a running program, I want to enable perfmark for a time, and write the trace data to a file.
Then later, I want to restart perfmark again and save a second set of trace data, not containing the trace data from the first time perfmark was activated.

To achieve this there should be some way to clear the Storage, but there is currently no way to this (as far as I could find).
The Storage.resetForTest() method does clear the storage but stops perfmark from properly tracing multiple treads afterwards.
Recording everything and splitting it up later is also not desirable, as this would cause perfmark to take up more and more memory with each use.

@carl-mastrangelo
Copy link
Member

Let me think about how to do it. Putting a few thoughts down:

  • Each thread assumes it's the only writer so having an external thread try to touch the buffer will likely have some cost.
  • The wait-free nature of perfmark may be lost if external writes to a thread local buffer are allowed. Would you be okay with possibly blocking?
  • It sounds like you might actually prefer having PerfMark write directly to disk.

@LGoossens
Copy link
Author

LGoossens commented Jul 22, 2021

In my case there would be a button to enable/disable perfmark, where disabling also writes to a file and clears the storage.
In a case like this clearing is not used excessively, so I would think some cost is not likely to be an issue.

@carl-mastrangelo
Copy link
Member

In https://github.com/perfmark/perfmark/releases/tag/v0.26.0 PerfMark now has better methods for clearing storage in memory. The methods there are designed to allow existing threads to keep recording, but avoids synchronizing from the clearingThread to the other threads.

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

No branches or pull requests

2 participants