diff options
author | Cinnamon Shia <cinnamon.shia@hpe.com> | 2015-11-10 04:57:14 +0000 |
---|---|---|
committer | lzeng14 <lzeng14@Edk2> | 2015-11-10 04:57:14 +0000 |
commit | d28f77df0f51f84b0af79f09abe2c27b1f1aaa69 (patch) | |
tree | a6db5eaa02240cb24f89430e1909b9d7530b75c8 /PerformancePkg/Dp_App/DpTrace.c | |
parent | 62cae3513b5844c93d41d1ae9a4ae1c6f268cd37 (diff) | |
download | edk2-platforms-d28f77df0f51f84b0af79f09abe2c27b1f1aaa69.tar.xz |
PerformancePkg/Dp_App: Support dumping cumulative data
Add a new option -c to dump cumulative data.
For example:
shell> dp -c
==[ Cumulative ]========
(Times in microsec.) Cumulative Average Shortest Longest
Name Count Duration Duration Duration Duration
LoadImage: 200 1000000 7000 0 100000
StartImage: 200 20000000 90000 0 7000000
DB:Start: 200 20000000 100000 0 9000000
DB:Support: 200000 100000 0 0 7000
shell> dp -c DXE
==[ Cumulative ]========
(Times in microsec.) Cumulative Average Shortest Longest
Name Count Duration Duration Duration Duration
LoadImage: 200 1000000 7000 0 100000
StartImage: 200 20000000 90000 0 7000000
DB:Start: 200 20000000 100000 0 9000000
DB:Support: 200000 100000 0 0 7000
DXE 1 30000000 30000000 0 30000000
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Cinnamon Shia <cinnamon.shia@hpe.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18762 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'PerformancePkg/Dp_App/DpTrace.c')
-rw-r--r-- | PerformancePkg/Dp_App/DpTrace.c | 56 |
1 files changed, 51 insertions, 5 deletions
diff --git a/PerformancePkg/Dp_App/DpTrace.c b/PerformancePkg/Dp_App/DpTrace.c index 1ba2b72ba4..d3df30ff28 100644 --- a/PerformancePkg/Dp_App/DpTrace.c +++ b/PerformancePkg/Dp_App/DpTrace.c @@ -2,6 +2,7 @@ Trace reporting for the Dp utility.
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+ (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -42,11 +43,14 @@ @post The SummaryData and CumData structures contain statistics for the
current performance logs.
+
+ @param[in, out] CustomCumulativeData A pointer to the cumtom cumulative data.
+
**/
VOID
GatherStatistics(
- VOID
-)
+ IN OUT PERF_CUM_DATA *CustomCumulativeData OPTIONAL
+ )
{
MEASUREMENT_RECORD Measurement;
UINT64 Duration;
@@ -98,6 +102,20 @@ GatherStatistics( CumData[TIndex].MaxDur = Duration;
}
}
+
+ //
+ // Collect the data for custom cumulative data.
+ //
+ if ((CustomCumulativeData != NULL) && (AsciiStrCmp (Measurement.Token, CustomCumulativeData->Name) == 0)) {
+ CustomCumulativeData->Duration += Duration;
+ CustomCumulativeData->Count++;
+ if (Duration < CustomCumulativeData->MinDur) {
+ CustomCumulativeData->MinDur = Duration;
+ }
+ if (Duration > CustomCumulativeData->MaxDur) {
+ CustomCumulativeData->MaxDur = Duration;
+ }
+ }
}
}
@@ -785,12 +803,14 @@ ProcessGlobal( For each record with a Token listed in the CumData array:<BR>
- Update the instance count and the total, minimum, and maximum durations.
Finally, print the gathered cumulative statistics.
-
+
+ @param[in] CustomCumulativeData A pointer to the cumtom cumulative data.
+
**/
VOID
ProcessCumulative(
- VOID
-)
+ IN PERF_CUM_DATA *CustomCumulativeData OPTIONAL
+ )
{
UINT64 AvgDur; // the computed average duration
UINT64 Dur;
@@ -829,4 +849,30 @@ ProcessCumulative( );
}
}
+
+ //
+ // Print the custom cumulative data.
+ //
+ if (CustomCumulativeData != NULL) {
+ if (CustomCumulativeData->Count != 0) {
+ AvgDur = DivU64x32 (CustomCumulativeData->Duration, CustomCumulativeData->Count);
+ AvgDur = DurationInMicroSeconds (AvgDur);
+ Dur = DurationInMicroSeconds (CustomCumulativeData->Duration);
+ MaxDur = DurationInMicroSeconds (CustomCumulativeData->MaxDur);
+ MinDur = DurationInMicroSeconds (CustomCumulativeData->MinDur);
+ } else {
+ AvgDur = 0;
+ Dur = 0;
+ MaxDur = 0;
+ MinDur = 0;
+ }
+ PrintToken (STRING_TOKEN (STR_DP_CUMULATIVE_STATS),
+ CustomCumulativeData->Name,
+ CustomCumulativeData->Count,
+ Dur,
+ AvgDur,
+ MinDur,
+ MaxDur
+ );
+ }
}
|