Skip to content

Commit b32f57c

Browse files
committed
[forge] support emit mode in raw transactions workload
1 parent 6fde6b5 commit b32f57c

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

testsuite/testcases/src/load_vs_perf_benchmark.rs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub struct SingleRunStats {
3333
pub enum Workloads {
3434
TPS(Vec<usize>),
3535
TRANSACTIONS(Vec<TransactionWorkload>),
36-
RawTransactions(Vec<(String, TransactionType)>),
36+
RawTransactions(Vec<RawTransactionWorkload>),
3737
}
3838

3939
impl Workloads {
@@ -74,7 +74,7 @@ impl Workloads {
7474
},
7575
Self::TRANSACTIONS(workloads) => format!("TRANSACTIONS({:?})", workloads[index]),
7676
Self::RawTransactions(workloads) => {
77-
format!("RAW TRANSACTIONS({:?})", workloads[index].0)
77+
format!("RAW TRANSACTIONS({:?})", workloads[index].name)
7878
},
7979
}
8080
}
@@ -95,7 +95,7 @@ impl Workloads {
9595
},
9696
workloads[index].phase_name(phase)
9797
),
98-
Self::RawTransactions(workloads) => format!("{}: {}", index, workloads[index].0),
98+
Self::RawTransactions(workloads) => format!("{}: {}", index, workloads[index].name),
9999
}
100100
}
101101

@@ -104,7 +104,10 @@ impl Workloads {
104104
Self::TPS(tpss) => request.mode(EmitJobMode::ConstTps { tps: tpss[index] }),
105105
Self::TRANSACTIONS(workloads) => workloads[index].configure(request),
106106
Self::RawTransactions(workloads) => {
107-
request.transaction_type(workloads[index].1.clone())
107+
let workload = &workloads[index];
108+
request
109+
.mode(workload.emit_job_mode.clone())
110+
.transaction_type(workload.workload.clone())
108111
},
109112
}
110113
}
@@ -248,6 +251,22 @@ impl TransactionWorkload {
248251
}
249252
}
250253

254+
pub struct RawTransactionWorkload {
255+
name: String,
256+
workload: TransactionType,
257+
emit_job_mode: EmitJobMode,
258+
}
259+
260+
impl RawTransactionWorkload {
261+
pub fn new(name: String, workload: TransactionType, emit_job_mode: EmitJobMode) -> Self {
262+
Self {
263+
name,
264+
workload,
265+
emit_job_mode,
266+
}
267+
}
268+
}
269+
251270
pub struct BackgroundTraffic {
252271
pub traffic: EmitJobRequest,
253272
pub criteria: Vec<SuccessCriteria>,

0 commit comments

Comments
 (0)