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

Fix and optimize query profiling #57095

Merged
merged 2 commits into from
Jan 8, 2019
Merged

Fix and optimize query profiling #57095

merged 2 commits into from
Jan 8, 2019

Conversation

Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Dec 24, 2018

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 24, 2018
@Zoxc
Copy link
Contributor Author

Zoxc commented Dec 24, 2018

@bors try

@bors
Copy link
Contributor

bors commented Dec 24, 2018

⌛ Trying commit 7c985beec1d57f2bfe6890f47eeab641c879ece3 with merge e12bb21de0cda2992dd77eb54755b113dea148f5...

@bors
Copy link
Contributor

bors commented Dec 24, 2018

☀️ Test successful - status-travis
State: approved= try=True

@Zoxc
Copy link
Contributor Author

Zoxc commented Dec 24, 2018

@rust-timer build e12bb21de0cda2992dd77eb54755b113dea148f5

@rust-timer
Copy link
Collaborator

Success: Queued e12bb21de0cda2992dd77eb54755b113dea148f5 with parent 94bf2c1, comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit e12bb21de0cda2992dd77eb54755b113dea148f5

Copy link
Member

@michaelwoerister michaelwoerister left a comment

Choose a reason for hiding this comment

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

Thanks, @Zoxc! Good idea to record query counts in bulk.
r=me with the functions renamed.

@@ -742,6 +734,17 @@ macro_rules! define_queries_inner {
}
}

pub fn record_query_hits(&self, sess: &Session) {
Copy link
Member

Choose a reason for hiding this comment

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

This should be called something like record_queries_computed unless I'm misreading something.

pub fn record_query(&mut self, category: ProfileCategory) {
let (hits, total) = *self.data.query_counts.get(category);
self.data.query_counts.set(category, (hits, total + 1));
pub fn record_queries(&mut self, category: ProfileCategory, count: usize) {
Copy link
Member

Choose a reason for hiding this comment

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

This should renamed to record_queries_computed too then.

result
} else {
// We could not load a result from the on-disk cache, so
// recompute.

self.sess.profiler(|p| p.start_activity(Q::CATEGORY));
Copy link
Member

Choose a reason for hiding this comment

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

Just a remark: There should probably be a third category here for things that could be re-used but are not stored in the cache. Not sure how to best handle this.

self.data.query_counts.set(category, (hits, total + 1));
pub fn record_queries(&mut self, category: ProfileCategory, count: usize) {
let (hits, computed) = *self.data.query_counts.get(category);
self.data.query_counts.set(category, (hits, computed + count as u64));
Copy link
Member

Choose a reason for hiding this comment

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

An issue for another PR: This looks like we could get missed updates here (and below) with parallel queries.

@Zoxc
Copy link
Contributor Author

Zoxc commented Jan 7, 2019

@bors r=michaelwoerister

@bors
Copy link
Contributor

bors commented Jan 7, 2019

📌 Commit 23c742c has been approved by michaelwoerister

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 7, 2019
@bors
Copy link
Contributor

bors commented Jan 8, 2019

⌛ Testing commit 23c742c with merge 9d54812...

bors added a commit that referenced this pull request Jan 8, 2019
@bors
Copy link
Contributor

bors commented Jan 8, 2019

☀️ Test successful - status-appveyor, status-travis
Approved by: michaelwoerister
Pushing 9d54812 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants