1 /** @file 2 Common declarations for the Dp Performance Reporting Utility. 3 4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 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 19 #define DP_MAJOR_VERSION 2 20 #define DP_MINOR_VERSION 3 21 22 /** 23 * The value assigned to DP_DEBUG controls which debug output 24 * is generated. Set it to ZERO to disable. 25 **/ 26 #define DP_DEBUG 0 27 28 /** 29 * Set to 1 once Profiling has been implemented in order to enable 30 * profiling related options and report output. 31 **/ 32 #define PROFILING_IMPLEMENTED 0 33 34 #define DEFAULT_THRESHOLD 1000 ///< One millisecond. 35 #define DEFAULT_DISPLAYCOUNT 50 36 #define MAXIMUM_DISPLAYCOUNT 999999 ///< Arbitrary maximum reasonable number. 37 38 #define PERF_MAXDUR 0xFFFFFFFFFFFFFFFFULL 39 40 /// Determine whether 0 <= C < L. If L == 0, return true regardless of C. 41 #define WITHIN_LIMIT( C, L) ( ((L) == 0) || ((C) < (L)) ) 42 43 /// Structure for storing Timer specific information. 44 typedef struct { 45 UINT64 StartCount; ///< Value timer is initialized with. 46 UINT64 EndCount; ///< Value timer has just before it wraps. 47 UINT32 Frequency; ///< Timer count frequency in KHz. 48 BOOLEAN CountUp; ///< TRUE if the counter counts up. 49 } TIMER_INFO; 50 51 /** Initialize one PERF_CUM_DATA structure instance for token t. 52 * 53 * This parameterized macro takes a single argument, t, which is expected 54 * to resolve to a pointer to an ASCII string literal. This parameter may 55 * take any one of the following forms: 56 * - PERF_INIT_CUM_DATA("Token") A string literal 57 * - PERF_INIT_CUM_DATA(pointer) A pointer -- CHAR8 *pointer; 58 * - PERF_INIT_CUM_DATA(array) Address of an array -- CHAR8 array[N]; 59 **/ 60 #define PERF_INIT_CUM_DATA(t) { 0ULL, PERF_MAXDUR, 0ULL, (t), 0U } 61 62 typedef struct { 63 UINT64 Duration; ///< Cumulative duration for this item. 64 UINT64 MinDur; ///< Smallest duration encountered. 65 UINT64 MaxDur; ///< Largest duration encountered. 66 CHAR8 *Name; ///< ASCII name of this item. 67 UINT32 Count; ///< Total number of measurements accumulated. 68 } PERF_CUM_DATA; 69 70 typedef struct { 71 UINT32 NumTrace; ///< Number of recorded TRACE performance measurements. 72 UINT32 NumProfile; ///< Number of recorded PROFILE performance measurements. 73 UINT32 NumIncomplete; ///< Number of measurements with no END value. 74 UINT32 NumSummary; ///< Number of summary section measurements. 75 UINT32 NumHandles; ///< Number of measurements with handles. 76 UINT32 NumPEIMs; ///< Number of measurements of PEIMs. 77 UINT32 NumGlobal; ///< Number of measurements with END value and NULL handle. 78 } PERF_SUMMARY_DATA; 79 80 typedef struct { 81 CONST VOID *Handle; 82 CONST CHAR8 *Token; ///< Measured token string name. 83 CONST CHAR8 *Module; ///< Module string name. 84 UINT64 StartTimeStamp; ///< Start time point. 85 UINT64 EndTimeStamp; ///< End time point. 86 UINT32 Identifier; ///< Identifier. 87 } MEASUREMENT_RECORD; 88 89 typedef struct { 90 CHAR8 *Name; ///< Measured token string name. 91 UINT64 CumulativeTime; ///< Accumulated Elapsed Time. 92 UINT64 MinTime; ///< Minimum Elapsed Time. 93 UINT64 MaxTime; ///< Maximum Elapsed Time. 94 UINT32 Count; ///< Number of measurements accumulated. 95 } PROFILE_RECORD; 96 97 typedef struct { 98 UINT16 Token; 99 SHELL_PARAM_TYPE Type; 100 } PARAM_ITEM_LIST; 101 #endif // _EFI_APP_DP_H_ 102