Skip to content

Add profiling manager snippets for how-to-capture DAC docs #564

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

Conversation

edgararriagag
Copy link
Contributor

Adding some snippets required for the upcoming Profiling Manager sections for DAC documents

Copy link

snippet-bot bot commented Jul 11, 2025

Here is the summary of changes.

You are about to add 2 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

Copy link

@AliceYuan AliceYuan left a comment

Choose a reason for hiding this comment

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

Looks good, added some nits

// Computations you want to profile
}

void sampleRecordSystemTrace() {

Choose a reason for hiding this comment

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

should we just start the code snippet right before this function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, I also did the same for kotlin snippet. ptal and reopen if I missed anything

super.onCreate(savedInstanceState)
sampleRecordSystemTrace()
}

Choose a reason for hiding this comment

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

same q around just showing the function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

SystemTraceRequestBuilder requestBuilder = new SystemTraceRequestBuilder();
requestBuilder.setCancellationSignal(stopSignal);
requestBuilder.setTag("FOO");
requestBuilder.setDurationMs(60000);

Choose a reason for hiding this comment

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

can we pull this into duration const

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there a reason to want to pull this into a const, if we could, I prefer to leave as is because that way we make the snippet as hermatic as possible and we don't have to tweak the current wording of the snippet explanation in the DAC docs.

requestBuilder.setCancellationSignal(stopSignal)
requestBuilder.setTag("FOO") // Caller supplied tag for identification
requestBuilder.setDurationMs(60000)
requestBuilder.setBufferFillPolicy(BufferFillPolicy.RING_BUFFER)

Choose a reason for hiding this comment

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

can we share what the other options are in a comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The constructor methods are subject to change, we did not mean to be exhaustive here but provide an example. I think there's only one more method not shown here which is the setBufferSizeKb, I added it instead to the sample itself, I think its a bit odd to add it as a comment, so instead I integrated it directly

@edgararriagag
Copy link
Contributor Author

It looks like the bringing patches from forked repos doesn't work, so I will go ahead and post it directly into the main repository, the new PR is #568 . Closing this one as the review will finish in the new one.

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