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

The "cache read miss" is now the compiler step. Make it more explicit #1527

Merged
merged 3 commits into from
Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/compiler/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,12 @@ where
out_pretty.clone(),
)
.await?;
let duration = start.elapsed();
let duration_compilation = start.elapsed();
if !compiler_result.status.success() {
debug!(
"[{}]: Compiled in {}, but failed, not storing in cache",
out_pretty,
fmt_duration_as_secs(&duration)
fmt_duration_as_secs(&duration_compilation)
);
return Ok((CompileResult::CompileFailed, compiler_result));
}
Expand All @@ -359,14 +359,14 @@ where
debug!(
"[{}]: Compiled in {}, but not cacheable",
out_pretty,
fmt_duration_as_secs(&duration)
fmt_duration_as_secs(&duration_compilation)
);
return Ok((CompileResult::NotCacheable, compiler_result));
}
debug!(
"[{}]: Compiled in {}, storing in cache",
out_pretty,
fmt_duration_as_secs(&duration)
fmt_duration_as_secs(&duration_compilation)
);
let start_create_artifact = Instant::now();
let mut entry = CacheWrite::from_objects(outputs, &pool)
Expand Down Expand Up @@ -398,7 +398,7 @@ where
};
let future = Box::pin(future);
Ok((
CompileResult::CacheMiss(miss_type, dist_type, duration, future),
CompileResult::CacheMiss(miss_type, dist_type, duration_compilation, future),
compiler_result,
))
}
Expand Down Expand Up @@ -784,7 +784,7 @@ pub enum CompileResult {
CacheMiss(
MissType,
DistType,
Duration,
Duration, // Compilation time
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe use BoxFuture?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sorry but why ? :)

Copy link
Collaborator

@Xuanwo Xuanwo Jan 6, 2023

Choose a reason for hiding this comment

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

Oh, no strong reasons, just to avoid repeating Pin Box things 🤣

Pin<Box<dyn Future<Output = Result<CacheWriteInfo>> + Send>>,
),
/// Not in cache, but the compilation result was determined to be not cacheable.
Expand Down
10 changes: 5 additions & 5 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ where
}
}
stats.cache_misses.increment(&kind);
stats.cache_read_miss_duration += duration;
stats.compiler_write_duration += duration;
cache_write = Some(future);
}
CompileResult::NotCacheable => {
Expand Down Expand Up @@ -1390,7 +1390,7 @@ pub struct ServerStats {
/// The total time spent reading cache hits.
pub cache_read_hit_duration: Duration,
/// The total time spent reading cache misses.
pub cache_read_miss_duration: Duration,
pub compiler_write_duration: Duration,
/// The count of compilation failures.
pub compile_fails: u64,
/// Counts of reasons why compiles were not cached.
Expand Down Expand Up @@ -1440,7 +1440,7 @@ impl Default for ServerStats {
cache_writes: u64::default(),
cache_write_duration: Duration::new(0, 0),
cache_read_hit_duration: Duration::new(0, 0),
cache_read_miss_duration: Duration::new(0, 0),
compiler_write_duration: Duration::new(0, 0),
compile_fails: u64::default(),
not_cached: HashMap::new(),
dist_compiles: HashMap::new(),
Expand Down Expand Up @@ -1528,9 +1528,9 @@ impl ServerStats {
);
set_duration_stat!(
stats_vec,
self.cache_read_miss_duration,
self.compiler_write_duration,
self.cache_misses.all(),
"Average cache read miss"
"Average compiler"
);
set_duration_stat!(
stats_vec,
Expand Down