Course: Computer Architectures
Example: Lab 01 - gem5 and ASE Studio
Weighted execution time describes how much each program contributes to the average execution time of a workload, taking account of how often it runs.
What a weight means
In Lab 01, a weight is the fraction of program runs assigned to a particular program. A 63% weight means that, out of 100 runs, 63 are runs of that program. It does not mean the program executes 63% faster or receives 63% of the processor’s time.
The exercise supplies the weights. Convert each percentage to a decimal before multiplying: 63% = 0.63, 25% = 0.25, and 1% = 0.01. All weights in a scenario sum to 1, or 100%.
Calculation
First find the execution time of one run of each program:
Here, is its measured clock-cycle count and is the frequency in cycles per second. Lab 01 assumes Hz.
Multiply that time by the program’s weight:
Add the contributions to obtain the weighted average time per run:
Lab 01 Scenario 1 example
Using the 2026-10-07 measurements with forwarding disabled:
| Program | Cycles | Time per run (s) | Weight | Weighted contribution (s) |
|---|---|---|---|---|
| program_1 | 174 | 0.099429 | 1% | 0.000994 |
| program_2 | 952 | 0.544000 | 63% | 0.342720 |
| calculate_pi | 4637 | 2.649714 | 25% | 0.662429 |
| insertion_sort | 24236 | 13.849143 | 11% | 1.523406 |
| Average time per run | 100% | 2.529549 |
For example, program_2 contributes:
The average over this mix is approximately 2.53 seconds per run. Compute with unrounded values and round only the final displayed results.
Average time versus total time
For sequential runs with the same proportions:
For 100 runs in Scenario 1, there are 1 Fibonacci run, 63 array-matching runs, 25 pi runs, and 11 sorting runs. Their combined execution time is approximately 252.95 seconds. This assumes the measured time per run stays the same and excludes launch overhead and overlap between runs.
The lab table calls the sum of the weighted contributions “TOTAL Time.” Under these normalized run-frequency weights, that sum represents the average time per run, rather than the wall-clock duration of 100 runs.
How it was obtained
Each program was simulated separately to measure its cycle count. The execution times and workload weights were applied afterward; the weighted scenarios were not simulated as combined workloads.
With equal weights of 25% for four programs, the formula reduces to the ordinary arithmetic mean of their four execution times.