handle multiple performance manager options

by default, shellchat drives the performance management interface.
But if an alternative one is specified, it overrides shellchat.
This commit is contained in:
bunnie 2022-10-23 23:17:16 +08:00
parent f05a879d93
commit 901525e3c9
2 changed files with 9 additions and 0 deletions

View file

@ -257,6 +257,10 @@ impl Builder {
self.features.retain(|x| x != feature);
self
}
/// test if a feature is present
pub fn has_feature(&self, feature: &str) -> bool {
self.features.contains(feature)
}
/// add a feature to be passed on to just the loader
pub fn add_loader_feature<'a>(&'a mut self, feature: &str) -> &'a mut Builder {
self.loader_features.push(feature.into());

View file

@ -272,6 +272,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.add_apps(&get_cratespecs());
}
Some("perf-image") => {
// `--feature vaultperf` will make `vault` the performance manager, in exclusion of shellchat
if !build.contains("shellperf") && !builder.contains("vaultperf") {
// select `shellchat` as the performance manager by default.
builder.add_feature("shellperf");
}
// note: to use this image, you need to load a version of the SOC that has the performance counters built in.
// this can be generated using the command `python3 .\betrusted_soc.py -e .\dummy.nky --perfcounter` in the betrusted-soc repo.
//