1 | /** @file
|
---|
2 | Common declarations for the Dp Performance Reporting Utility.
|
---|
3 |
|
---|
4 | Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.
|
---|
5 | This program and the accompanying materials
|
---|
6 | are licensed and made available under the terms and conditions of the BSD License
|
---|
7 | which accompanies this distribution. The full text of the license may be found at
|
---|
8 | http://opensource.org/licenses/bsd-license.php
|
---|
9 |
|
---|
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
---|
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
---|
12 | **/
|
---|
13 |
|
---|
14 | #ifndef _EFI_APP_DP_H_
|
---|
15 | #define _EFI_APP_DP_H_
|
---|
16 |
|
---|
17 | #include <Library/ShellLib.h>
|
---|
18 | #include <ShellBase.h>
|
---|
19 |
|
---|
20 | #define DP_MAJOR_VERSION 2
|
---|
21 | #define DP_MINOR_VERSION 4
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * The value assigned to DP_DEBUG controls which debug output
|
---|
25 | * is generated. Set it to ZERO to disable.
|
---|
26 | **/
|
---|
27 | #define DP_DEBUG 0
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * Set to 1 once Profiling has been implemented in order to enable
|
---|
31 | * profiling related options and report output.
|
---|
32 | **/
|
---|
33 | #define PROFILING_IMPLEMENTED 0
|
---|
34 |
|
---|
35 | #define DEFAULT_THRESHOLD 1000 ///< One millisecond.
|
---|
36 | #define DEFAULT_DISPLAYCOUNT 50
|
---|
37 | #define MAXIMUM_DISPLAYCOUNT 999999 ///< Arbitrary maximum reasonable number.
|
---|
38 |
|
---|
39 | #define PERF_MAXDUR 0xFFFFFFFFFFFFFFFFULL
|
---|
40 |
|
---|
41 | /// Determine whether 0 <= C < L. If L == 0, return true regardless of C.
|
---|
42 | #define WITHIN_LIMIT( C, L) ( ((L) == 0) || ((C) < (L)) )
|
---|
43 |
|
---|
44 | /// Structure for storing Timer specific information.
|
---|
45 | typedef struct {
|
---|
46 | UINT64 StartCount; ///< Value timer is initialized with.
|
---|
47 | UINT64 EndCount; ///< Value timer has just before it wraps.
|
---|
48 | UINT32 Frequency; ///< Timer count frequency in KHz.
|
---|
49 | BOOLEAN CountUp; ///< TRUE if the counter counts up.
|
---|
50 | } TIMER_INFO;
|
---|
51 |
|
---|
52 | /** Initialize one PERF_CUM_DATA structure instance for token t.
|
---|
53 | *
|
---|
54 | * This parameterized macro takes a single argument, t, which is expected
|
---|
55 | * to resolve to a pointer to an ASCII string literal. This parameter may
|
---|
56 | * take any one of the following forms:
|
---|
57 | * - PERF_INIT_CUM_DATA("Token") A string literal
|
---|
58 | * - PERF_INIT_CUM_DATA(pointer) A pointer -- CHAR8 *pointer;
|
---|
59 | * - PERF_INIT_CUM_DATA(array) Address of an array -- CHAR8 array[N];
|
---|
60 | **/
|
---|
61 | #define PERF_INIT_CUM_DATA(t) { 0ULL, PERF_MAXDUR, 0ULL, (t), 0U }
|
---|
62 |
|
---|
63 | typedef struct {
|
---|
64 | UINT64 Duration; ///< Cumulative duration for this item.
|
---|
65 | UINT64 MinDur; ///< Smallest duration encountered.
|
---|
66 | UINT64 MaxDur; ///< Largest duration encountered.
|
---|
67 | CHAR8 *Name; ///< ASCII name of this item.
|
---|
68 | UINT32 Count; ///< Total number of measurements accumulated.
|
---|
69 | } PERF_CUM_DATA;
|
---|
70 |
|
---|
71 | typedef struct {
|
---|
72 | UINT32 NumTrace; ///< Number of recorded TRACE performance measurements.
|
---|
73 | UINT32 NumProfile; ///< Number of recorded PROFILE performance measurements.
|
---|
74 | UINT32 NumIncomplete; ///< Number of measurements with no END value.
|
---|
75 | UINT32 NumSummary; ///< Number of summary section measurements.
|
---|
76 | UINT32 NumHandles; ///< Number of measurements with handles.
|
---|
77 | UINT32 NumPEIMs; ///< Number of measurements of PEIMs.
|
---|
78 | UINT32 NumGlobal; ///< Number of measurements with END value and NULL handle.
|
---|
79 | } PERF_SUMMARY_DATA;
|
---|
80 |
|
---|
81 | typedef struct {
|
---|
82 | CONST VOID *Handle;
|
---|
83 | CONST CHAR8 *Token; ///< Measured token string name.
|
---|
84 | CONST CHAR8 *Module; ///< Module string name.
|
---|
85 | UINT64 StartTimeStamp; ///< Start time point.
|
---|
86 | UINT64 EndTimeStamp; ///< End time point.
|
---|
87 | UINT32 Identifier; ///< Identifier.
|
---|
88 | } MEASUREMENT_RECORD;
|
---|
89 |
|
---|
90 | typedef struct {
|
---|
91 | CHAR8 *Name; ///< Measured token string name.
|
---|
92 | UINT64 CumulativeTime; ///< Accumulated Elapsed Time.
|
---|
93 | UINT64 MinTime; ///< Minimum Elapsed Time.
|
---|
94 | UINT64 MaxTime; ///< Maximum Elapsed Time.
|
---|
95 | UINT32 Count; ///< Number of measurements accumulated.
|
---|
96 | } PROFILE_RECORD;
|
---|
97 |
|
---|
98 | #endif // _EFI_APP_DP_H_
|
---|