Skip to content

Commit 11af818

Browse files
Sherry Fanmergify[bot]
authored andcommitted
SecurityPkg: Refactor performance to use new PERF_FUNCTION_* measurements
Use the new PERF_FUNCTION_START/END instrumentation for simpler perf measurement. Signed-off-by: Sherry Fan <[email protected]>
1 parent aa02571 commit 11af818

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
4646
#include <Library/ReportStatusCodeLib.h>
4747
#include <Library/Tcg2PhysicalPresenceLib.h>
4848

49-
#define PERF_ID_TCG2_DXE 0x3120
50-
5149
typedef struct {
5250
CHAR16 *VariableName;
5351
EFI_GUID *VendorGuid;
@@ -2502,7 +2500,7 @@ OnReadyToBoot (
25022500
EFI_STATUS Status;
25032501
TPM_PCRINDEX PcrIndex;
25042502

2505-
PERF_START_EX (mImageHandle, "EventRec", "Tcg2Dxe", 0, PERF_ID_TCG2_DXE);
2503+
PERF_FUNCTION_BEGIN ();
25062504
if (mBootAttempts == 0) {
25072505
//
25082506
// Measure handoff tables.
@@ -2583,7 +2581,7 @@ OnReadyToBoot (
25832581
// Increase boot attempt counter.
25842582
//
25852583
mBootAttempts++;
2586-
PERF_END_EX (mImageHandle, "EventRec", "Tcg2Dxe", 0, PERF_ID_TCG2_DXE + 1);
2584+
PERF_FUNCTION_END ();
25872585
}
25882586

25892587
/**

SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
4141
#include <Library/ResetSystemLib.h>
4242
#include <Library/PrintLib.h>
4343

44-
#define PERF_ID_TCG2_PEI 0x3080
45-
4644
typedef struct {
4745
EFI_GUID *EventGuid;
4846
EFI_TCG2_EVENT_LOG_FORMAT LogFormat;
@@ -839,7 +837,7 @@ MeasureMainBios (
839837
EFI_FV_INFO VolumeInfo;
840838
EFI_PEI_FIRMWARE_VOLUME_PPI *FvPpi;
841839

842-
PERF_START_EX (mFileHandle, "EventRec", "Tcg2Pei", 0, PERF_ID_TCG2_PEI);
840+
PERF_FUNCTION_BEGIN ();
843841

844842
//
845843
// Only measure BFV at the very beginning. Other parts of Static Core Root of
@@ -870,7 +868,7 @@ MeasureMainBios (
870868

871869
Status = MeasureFvImage ((EFI_PHYSICAL_ADDRESS)(UINTN)VolumeInfo.FvStart, VolumeInfo.FvSize);
872870

873-
PERF_END_EX (mFileHandle, "EventRec", "Tcg2Pei", 0, PERF_ID_TCG2_PEI + 1);
871+
PERF_FUNCTION_END ();
874872

875873
return Status;
876874
}

0 commit comments

Comments
 (0)