VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.h

Last change on this file was 99404, checked in by vboxsync, 2 years ago

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • Property svn:eol-style set to native
File size: 4.8 KB
Line 
1/** @file
2 Header file for 'dp' command functions.
3
4 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7**/
8
9#ifndef _DP_H_
10#define _DP_H_
11
12#include <Uefi.h>
13
14#include <Guid/Performance.h>
15#include <Guid/ExtendedFirmwarePerformance.h>
16#include <Guid/FirmwarePerformance.h>
17
18#include <Protocol/HiiPackageList.h>
19#include <Protocol/DevicePath.h>
20#include <Protocol/LoadedImage.h>
21#include <Protocol/UnicodeCollation.h>
22
23#include <Library/BaseLib.h>
24#include <Library/BaseMemoryLib.h>
25#include <Library/DebugLib.h>
26#include <Library/MemoryAllocationLib.h>
27#include <Library/ShellLib.h>
28#include <Library/UefiLib.h>
29#include <Library/UefiRuntimeServicesTableLib.h>
30#include <Library/UefiBootServicesTableLib.h>
31#include <Library/PcdLib.h>
32#include <Library/SortLib.h>
33#include <Library/HiiLib.h>
34#include <Library/FileHandleLib.h>
35#include <Library/UefiHiiServicesLib.h>
36#include <Library/PerformanceLib.h>
37
38extern EFI_HII_HANDLE mDpHiiHandle;
39
40#define DP_MAJOR_VERSION 2
41#define DP_MINOR_VERSION 5
42
43/**
44 * The value assigned to DP_DEBUG controls which debug output
45 * is generated. Set it to ZERO to disable.
46**/
47#define DP_DEBUG 0
48
49#define DEFAULT_THRESHOLD 1000 ///< One millisecond.
50#define DEFAULT_DISPLAYCOUNT 50
51#define MAXIMUM_DISPLAYCOUNT 999999 ///< Arbitrary maximum reasonable number.
52
53#define PERF_MAXDUR 0xFFFFFFFFFFFFFFFFULL
54
55/// Determine whether 0 <= C < L. If L == 0, return true regardless of C.
56#define WITHIN_LIMIT(C, L) ( ((L) == 0) || ((C) < (L)) )
57
58/// Structure for storing Timer specific information.
59typedef struct {
60 UINT64 StartCount; ///< Value timer is initialized with.
61 UINT64 EndCount; ///< Value timer has just before it wraps.
62 UINT32 Frequency; ///< Timer count frequency in KHz.
63 BOOLEAN CountUp; ///< TRUE if the counter counts up.
64} TIMER_INFO;
65
66/** Initialize one PERF_CUM_DATA structure instance for token t.
67 *
68 * This parameterized macro takes a single argument, t, which is expected
69 * to resolve to a pointer to an ASCII string literal. This parameter may
70 * take any one of the following forms:
71 * - PERF_INIT_CUM_DATA("Token") A string literal
72 * - PERF_INIT_CUM_DATA(pointer) A pointer -- CHAR8 *pointer;
73 * - PERF_INIT_CUM_DATA(array) Address of an array -- CHAR8 array[N];
74**/
75#define PERF_INIT_CUM_DATA(t) { 0ULL, PERF_MAXDUR, 0ULL, (t), 0U }
76
77typedef struct {
78 UINT64 Duration; ///< Cumulative duration for this item.
79 UINT64 MinDur; ///< Smallest duration encountered.
80 UINT64 MaxDur; ///< Largest duration encountered.
81 CHAR8 *Name; ///< ASCII name of this item.
82 UINT32 Count; ///< Total number of measurements accumulated.
83} PERF_CUM_DATA;
84
85typedef struct {
86 UINT32 NumTrace; ///< Number of recorded TRACE performance measurements.
87 UINT32 NumIncomplete; ///< Number of measurements with no END value.
88 UINT32 NumSummary; ///< Number of summary section measurements.
89 UINT32 NumHandles; ///< Number of measurements with handles.
90 UINT32 NumPEIMs; ///< Number of measurements of PEIMs.
91 UINT32 NumGlobal; ///< Number of measurements with END value and NULL handle.
92} PERF_SUMMARY_DATA;
93
94typedef struct {
95 CONST VOID *Handle;
96 CONST CHAR8 *Token; ///< Measured token string name.
97 CONST CHAR8 *Module; ///< Module string name.
98 UINT64 StartTimeStamp; ///< Start time point.
99 UINT64 EndTimeStamp; ///< End time point.
100 UINT32 Identifier; ///< Identifier.
101} MEASUREMENT_RECORD;
102
103typedef struct {
104 CHAR8 *Name; ///< Measured token string name.
105 UINT64 CumulativeTime; ///< Accumulated Elapsed Time.
106 UINT64 MinTime; ///< Minimum Elapsed Time.
107 UINT64 MaxTime; ///< Maximum Elapsed Time.
108 UINT32 Count; ///< Number of measurements accumulated.
109} PROFILE_RECORD;
110
111/**
112 Dump performance data.
113
114 @param[in] ImageHandle The image handle.
115 @param[in] SystemTable The system table.
116
117 @retval SHELL_SUCCESS Command completed successfully.
118 @retval SHELL_INVALID_PARAMETER Command usage error.
119 @retval SHELL_ABORTED The user aborts the operation.
120 @retval value Unknown error.
121**/
122SHELL_STATUS
123RunDp (
124 IN EFI_HANDLE ImageHandle,
125 IN EFI_SYSTEM_TABLE *SystemTable
126 );
127
128/**
129 Retrieve HII package list from ImageHandle and publish to HII database.
130
131 @param ImageHandle The image handle of the process.
132
133 @return HII handle.
134**/
135EFI_HII_HANDLE
136InitializeHiiPackage (
137 EFI_HANDLE ImageHandle
138 );
139
140#endif // _DP_H_
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette