Fixed "page-temperature" graph not actually showing average temperatures.

This commit is contained in:
Filipe Rodrigues 2023-05-25 02:23:00 +01:00
parent d193e28549
commit b0d4011b3f
4 changed files with 25 additions and 16 deletions

1
Cargo.lock generated
View File

@ -220,6 +220,7 @@ name = "ftmemsim-graphs"
version = "0.1.0"
dependencies = [
"anyhow",
"average",
"clap",
"ftmemsim-util",
"gnuplot",

View File

@ -11,4 +11,5 @@ anyhow = { workspace = true }
serde_json = { workspace = true }
itertools = { workspace = true }
gnuplot = { workspace = true }
average = { workspace = true }
ftmemsim-util = { workspace = true }

View File

@ -14,7 +14,10 @@ use {
ftmemsim_util::logger,
gnuplot::{AxesCommon, PlotOption},
itertools::Itertools,
std::{collections::BTreeMap, path::Path},
std::{
collections::{BTreeMap, HashMap},
path::Path,
},
};
fn main() -> Result<(), anyhow::Error> {
@ -135,16 +138,20 @@ fn main() -> Result<(), anyhow::Error> {
.into_option()
.unwrap_or((0, 1));
let mut temp_cur_average = 0.0;
let mut cur_temps = HashMap::new();
let (points_x, points_y) = page_accesses
.accesses
.iter()
.enumerate()
.map(|(idx, page_access)| {
temp_cur_average += page_access.cur_temp as f64;
.map(|page_access| {
*cur_temps.entry(page_access.page_ptr).or_insert(0) = page_access.cur_temp;
(
(page_access.time - min_time) as f64 / (max_time - min_time) as f64,
temp_cur_average / (idx as f64 + 1.0),
cur_temps
.values()
.map(|&temp| temp as f64)
.collect::<average::Mean>()
.mean(),
)
})
.unzip::<_, _, Vec<_>, Vec<_>>();

20
run.sh
View File

@ -5,27 +5,27 @@ set -e
RUST_FILE_LOG="trace,ftmemsim::classifiers::hemem=debug"
LOG_FILE="latest.log"
PROFILE="dev"
#PROFILE="release"
#PROFILE="dev"
PROFILE="release"
#TRACE_FILE="resources/traces/bfs.g5.n5.trace"
TRACE_FILE="resources/traces/bfs.g15.n15.trace"
#TRACE_FILE="resources/traces/bfs.g17.n100.t1.trace"
#TRACE_FILE="resources/traces/bfs.g15.n15.trace"
TRACE_FILE="resources/traces/bfs.g17.n100.t1.trace"
#TRACE_FILE="resources/traces/bc.g18.n100.t1.trace"
CONFIG="config.json"
OUTPUT_WIDTH="1000"
OUTPUT_WIDTH="8000"
OUTPUT_HEIGHT="1000"
rm -rf "$LOG_FILE"
echo "Simulating"
cargo run --profile "$PROFILE" -p ftmemsim -- \
--log-file-append \
--log-file "$LOG_FILE" \
--config "$CONFIG" \
"$TRACE_FILE"
#cargo run --profile "$PROFILE" -p ftmemsim -- \
# --log-file-append \
# --log-file "$LOG_FILE" \
# --config "$CONFIG" \
# "$TRACE_FILE"
echo "Creating graphs"
cargo run --profile "$PROFILE" -p ftmemsim-graphs -- \