mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-19 14:30:43 +00:00
feat/objbench:
### Update Metrics and Command Output - **`objbench.rs`**: - Renamed "Write time" to "Total time" in output. - Enhanced metrics output to include a sum of all metrics. - **`access_layer.rs`**: - Split `index` duration into `index_update` and `index_finish`. - Added a `sum` method to `Metrics` to calculate the total duration. - **`writer.rs`**: - Updated metrics to use `index_update` and `index_finish` for more granular tracking of index operations. Signed-off-by: Lei, HUANG <mrsatangel@gmail.com>
This commit is contained in:
@@ -227,10 +227,15 @@ impl Command {
|
||||
"Reader build time".bold(),
|
||||
reader_build_elapsed
|
||||
);
|
||||
println!(" {}: {:?}", "Write time".bold(), write_elapsed);
|
||||
println!(" {}: {:?}", "Total time".bold(), write_elapsed);
|
||||
|
||||
// Print metrics in a formatted way
|
||||
println!(" {}: {:?}", "Metrics".bold(), metrics);
|
||||
println!(
|
||||
" {}: {:?}, sum: {:?}",
|
||||
"Metrics".bold(),
|
||||
metrics,
|
||||
metrics.sum()
|
||||
);
|
||||
|
||||
// Cleanup
|
||||
println!("\n{}", "Cleaning up...".yellow());
|
||||
|
||||
@@ -48,10 +48,17 @@ pub struct Metrics {
|
||||
pub read: Duration,
|
||||
pub write: Duration,
|
||||
pub convert: Duration,
|
||||
pub index: Duration,
|
||||
pub index_update: Duration,
|
||||
pub index_finish: Duration,
|
||||
pub close: Duration,
|
||||
}
|
||||
|
||||
impl Metrics {
|
||||
pub fn sum(&self) -> Duration {
|
||||
self.read + self.write + self.convert + self.index_update + self.index_finish + self.close
|
||||
}
|
||||
}
|
||||
|
||||
/// A layer to access SST files under the same directory.
|
||||
pub struct AccessLayer {
|
||||
region_dir: String,
|
||||
|
||||
@@ -174,7 +174,7 @@ where
|
||||
stats.update(&batch);
|
||||
let index_start = Instant::now();
|
||||
self.get_or_create_indexer().await.update(&mut batch).await;
|
||||
metrics.index += index_start.elapsed();
|
||||
metrics.index_update += index_start.elapsed();
|
||||
}
|
||||
Err(e) => {
|
||||
self.get_or_create_indexer().await.abort().await;
|
||||
@@ -183,7 +183,9 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
let index_finish_start = Instant::now();
|
||||
let index_output = self.get_or_create_indexer().await.finish().await;
|
||||
metrics.index_finish += index_finish_start.elapsed();
|
||||
|
||||
if stats.num_rows == 0 {
|
||||
return Ok(smallvec![]);
|
||||
|
||||
Reference in New Issue
Block a user