forked from openzfs/zfs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DOSE-21 hit-rate-per-size reporting (openzfs#9)
Add a new hit-by-size histogram to zettacache that is updated whenever there is a successful lookup (for read). This captures the minimum cache size that would contain this block. Add a new command (zcache) that has subcommands to display and clear the new histogram.
- Loading branch information
Showing
31 changed files
with
876 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ members = [ | |
"object_perf", | ||
"server", | ||
"util", | ||
"zcache", | ||
"zcdb", | ||
"zettacache", | ||
"zettaobject", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
use lazy_static::lazy_static; | ||
use log::*; | ||
use log4rs::append::console::ConsoleAppender; | ||
use log4rs::append::file::FileAppender; | ||
use log4rs::config::Logger; | ||
use log4rs::config::{Appender, Config, Root}; | ||
use log4rs::encode::pattern::PatternEncoder; | ||
|
||
lazy_static! { | ||
static ref LOG_PATTERN: String = "[{d(%Y-%m-%d %H:%M:%S%.3f)}][{t}][{l}] {m}{n}".to_string(); | ||
} | ||
|
||
pub fn get_logging_level(verbosity: u64) -> LevelFilter { | ||
match verbosity { | ||
0 => LevelFilter::Warn, | ||
1 => LevelFilter::Info, | ||
2 => LevelFilter::Debug, | ||
_ => LevelFilter::Trace, | ||
} | ||
} | ||
|
||
fn setup_console_logging(verbosity: u64) { | ||
let config = Config::builder() | ||
.appender( | ||
Appender::builder().build( | ||
"stdout", | ||
Box::new( | ||
ConsoleAppender::builder() | ||
.encoder(Box::new(PatternEncoder::new(&*LOG_PATTERN))) | ||
.build(), | ||
), | ||
), | ||
) | ||
// rusoto_core::request is very chatty when set to debug. So, set it to info. | ||
.logger(Logger::builder().build("rusoto_core::request", LevelFilter::Info)) | ||
.build( | ||
Root::builder() | ||
.appender("stdout") | ||
.build(get_logging_level(verbosity)), | ||
) | ||
.unwrap(); | ||
|
||
log4rs::init_config(config).unwrap(); | ||
} | ||
|
||
fn setup_logfile(verbosity: u64, logfile: &str) { | ||
let config = Config::builder() | ||
.appender( | ||
Appender::builder().build( | ||
"logfile", | ||
Box::new( | ||
FileAppender::builder() | ||
.encoder(Box::new(PatternEncoder::new(&*LOG_PATTERN))) | ||
.build(logfile) | ||
.unwrap(), | ||
), | ||
), | ||
) | ||
// rusoto_core::request is very chatty when set to debug. So, set it to info. | ||
.logger(Logger::builder().build("rusoto_core::request", LevelFilter::Info)) | ||
.build( | ||
Root::builder() | ||
.appender("logfile") | ||
.build(get_logging_level(verbosity)), | ||
) | ||
.unwrap(); | ||
|
||
log4rs::init_config(config).unwrap(); | ||
} | ||
|
||
pub fn setup_logging(verbosity: u64, file_name: Option<&str>, log_config: Option<&str>) { | ||
match log_config { | ||
Some(config) => { | ||
log4rs::init_file(config, Default::default()).unwrap(); | ||
} | ||
None => { | ||
match file_name { | ||
Some(logfile) => { | ||
setup_logfile(verbosity, logfile); | ||
} | ||
None => { | ||
/* | ||
* When neither the log_config nor a log file is specified | ||
* log to console. | ||
*/ | ||
setup_console_logging(verbosity); | ||
} | ||
} | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "zcache" | ||
version = "0.1.0" | ||
authors = ["Delphix"] | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
anyhow = "1.0" | ||
chrono = "0.4" | ||
async-trait = "0.1.51" | ||
clap = "2" | ||
exitcode = "1.1.2" | ||
libc = "0.2" | ||
log = "0.4" | ||
more-asserts = "0.2.1" | ||
num-traits = "0.2.14" | ||
nvpair = { git = "https://github.com/ahrens/rust-libzfs", branch = "work"} | ||
tokio = { version = "1.4", features = ["full"] } | ||
util = { path = "../util" } |
Oops, something went wrong.