TianoCore EDK2 master
Loading...
Searching...
No Matches
PeiPerformanceLib.c
Go to the documentation of this file.
1
16#include <PiPei.h>
17
20
22#include <Library/DebugLib.h>
23#include <Library/HobLib.h>
24#include <Library/BaseLib.h>
25#include <Library/TimerLib.h>
26#include <Library/PcdLib.h>
28
29#define STRING_SIZE (FPDT_STRING_EVENT_RECORD_NAME_LENGTH * sizeof (CHAR8))
30#define PEI_MAX_RECORD_SIZE (sizeof (FPDT_DUAL_GUID_STRING_EVENT_RECORD) + STRING_SIZE)
31
44 IN UINT8 RecordSize,
45 IN OUT FPDT_RECORD_PTR *FpdtRecordPtr,
46 IN OUT FPDT_PEI_EXT_PERF_HEADER **PeiPerformanceLogHeader
47 )
48{
49 UINT16 PeiPerformanceLogEntries;
50 UINTN PeiPerformanceSize;
51 UINT8 *PeiFirmwarePerformance;
52 EFI_HOB_GUID_TYPE *GuidHob;
53
54 //
55 // Get the number of PeiPerformanceLogEntries form PCD.
56 //
57 PeiPerformanceLogEntries = (UINT16)(PcdGet16 (PcdMaxPeiPerformanceLogEntries16) != 0 ?
58 PcdGet16 (PcdMaxPeiPerformanceLogEntries16) :
59 PcdGet8 (PcdMaxPeiPerformanceLogEntries));
60
61 //
62 // Create GUID HOB Data.
63 //
64 GuidHob = GetFirstGuidHob (&gEdkiiFpdtExtendedFirmwarePerformanceGuid);
65 PeiFirmwarePerformance = NULL;
66 while (GuidHob != NULL) {
67 //
68 // PEI Performance HOB was found, then return the existing one.
69 //
70 PeiFirmwarePerformance = (UINT8 *)GET_GUID_HOB_DATA (GuidHob);
71 *PeiPerformanceLogHeader = (FPDT_PEI_EXT_PERF_HEADER *)PeiFirmwarePerformance;
72 if (!(*PeiPerformanceLogHeader)->HobIsFull && ((*PeiPerformanceLogHeader)->SizeOfAllEntries + RecordSize > (PeiPerformanceLogEntries * PEI_MAX_RECORD_SIZE))) {
73 (*PeiPerformanceLogHeader)->HobIsFull = TRUE;
74 }
75
76 if (!(*PeiPerformanceLogHeader)->HobIsFull && ((*PeiPerformanceLogHeader)->SizeOfAllEntries + RecordSize <= (PeiPerformanceLogEntries * PEI_MAX_RECORD_SIZE))) {
77 FpdtRecordPtr->RecordHeader = (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *)(PeiFirmwarePerformance + sizeof (FPDT_PEI_EXT_PERF_HEADER) + (*PeiPerformanceLogHeader)->SizeOfAllEntries);
78 break;
79 }
80
81 //
82 // Previous HOB is used, then find next one.
83 //
84 GuidHob = GetNextGuidHob (&gEdkiiFpdtExtendedFirmwarePerformanceGuid, GET_NEXT_HOB (GuidHob));
85 }
86
87 if (GuidHob == NULL) {
88 //
89 // PEI Performance HOB was not found, then build one.
90 //
91 PeiPerformanceSize = sizeof (FPDT_PEI_EXT_PERF_HEADER) +
92 PEI_MAX_RECORD_SIZE * PeiPerformanceLogEntries;
93 PeiFirmwarePerformance = (UINT8 *)BuildGuidHob (&gEdkiiFpdtExtendedFirmwarePerformanceGuid, PeiPerformanceSize);
94 if (PeiFirmwarePerformance != NULL) {
95 ZeroMem (PeiFirmwarePerformance, PeiPerformanceSize);
96 (*PeiPerformanceLogHeader) = (FPDT_PEI_EXT_PERF_HEADER *)PeiFirmwarePerformance;
97 FpdtRecordPtr->RecordHeader = (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER *)(PeiFirmwarePerformance + sizeof (FPDT_PEI_EXT_PERF_HEADER));
98 }
99 }
100
101 if (PeiFirmwarePerformance == NULL) {
102 //
103 // there is no enough resource to store performance data
104 //
105 return EFI_OUT_OF_RESOURCES;
106 }
107
108 return EFI_SUCCESS;
109}
110
120BOOLEAN
122 IN CONST CHAR8 *Token
123 )
124{
125 if (Token == NULL) {
126 return FALSE;
127 }
128
129 if ((AsciiStrCmp (Token, SEC_TOK) == 0) ||
130 (AsciiStrCmp (Token, PEI_TOK) == 0) ||
131 (AsciiStrCmp (Token, DXE_TOK) == 0) ||
132 (AsciiStrCmp (Token, BDS_TOK) == 0) ||
133 (AsciiStrCmp (Token, DRIVERBINDING_START_TOK) == 0) ||
134 (AsciiStrCmp (Token, DRIVERBINDING_SUPPORT_TOK) == 0) ||
135 (AsciiStrCmp (Token, DRIVERBINDING_STOP_TOK) == 0) ||
136 (AsciiStrCmp (Token, LOAD_IMAGE_TOK) == 0) ||
137 (AsciiStrCmp (Token, START_IMAGE_TOK) == 0) ||
138 (AsciiStrCmp (Token, PEIM_TOK) == 0))
139 {
140 return TRUE;
141 } else {
142 return FALSE;
143 }
144}
145
155BOOLEAN
157 IN UINT32 Identifier
158 )
159{
160 if ((Identifier == MODULE_START_ID) ||
161 (Identifier == MODULE_END_ID) ||
162 (Identifier == MODULE_LOADIMAGE_START_ID) ||
163 (Identifier == MODULE_LOADIMAGE_END_ID) ||
164 (Identifier == MODULE_DB_START_ID) ||
165 (Identifier == MODULE_DB_END_ID) ||
166 (Identifier == MODULE_DB_SUPPORT_START_ID) ||
167 (Identifier == MODULE_DB_SUPPORT_END_ID) ||
168 (Identifier == MODULE_DB_STOP_START_ID) ||
169 (Identifier == MODULE_DB_STOP_END_ID))
170 {
171 return TRUE;
172 } else {
173 return FALSE;
174 }
175}
176
193 IN BOOLEAN Attribute,
194 IN CONST VOID *Handle,
195 IN CONST CHAR8 *String,
196 OUT UINT16 *ProgressID
197 )
198{
199 //
200 // Get the ProgressID based on the Token.
201 // When PcdEdkiiFpdtStringRecordEnableOnly is TRUE, all records are with type of FPDT_DYNAMIC_STRING_EVENT_TYPE.
202 //
203 if (String != NULL) {
204 if (AsciiStrCmp (String, LOAD_IMAGE_TOK) == 0) {
205 // "LoadImage:"
206 if (Attribute == PerfStartEntry) {
207 *ProgressID = MODULE_LOADIMAGE_START_ID;
208 } else {
209 *ProgressID = MODULE_LOADIMAGE_END_ID;
210 }
211 } else if ((AsciiStrCmp (String, SEC_TOK) == 0) || // "SEC"
212 (AsciiStrCmp (String, PEI_TOK) == 0)) // "PEI"
213 {
214 if (Attribute == PerfStartEntry) {
215 *ProgressID = PERF_CROSSMODULE_START_ID;
216 } else {
217 *ProgressID = PERF_CROSSMODULE_END_ID;
218 }
219 } else if (AsciiStrCmp (String, PEIM_TOK) == 0) {
220 // "PEIM"
221 if (Attribute == PerfStartEntry) {
222 *ProgressID = MODULE_START_ID;
223 } else {
224 *ProgressID = MODULE_END_ID;
225 }
226 } else {
227 // Pref used in Modules.
228 if (Attribute == PerfStartEntry) {
229 *ProgressID = PERF_INMODULE_START_ID;
230 } else {
231 *ProgressID = PERF_INMODULE_END_ID;
232 }
233 }
234 } else if (Handle != NULL) {
235 // Pref used in Modules.
236 if (Attribute == PerfStartEntry) {
237 *ProgressID = PERF_INMODULE_START_ID;
238 } else {
239 *ProgressID = PERF_INMODULE_END_ID;
240 }
241 } else {
242 return EFI_INVALID_PARAMETER;
243 }
244
245 return EFI_SUCCESS;
246}
247
257VOID
259 IN OUT CHAR8 *Destination,
260 IN CONST CHAR8 *Source,
261 IN OUT UINT8 *Length
262 )
263{
264 UINTN StringLen;
265 UINTN DestMax;
266
267 ASSERT (Source != NULL);
268
269 if (PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) {
270 DestMax = STRING_SIZE;
271 } else {
272 DestMax = AsciiStrSize (Source);
273 if (DestMax > STRING_SIZE) {
274 DestMax = STRING_SIZE;
275 }
276 }
277
278 StringLen = AsciiStrLen (Source);
279 if (StringLen >= DestMax) {
280 StringLen = DestMax -1;
281 }
282
283 AsciiStrnCpyS (Destination, DestMax, Source, StringLen);
284 *Length += (UINT8)DestMax;
285
286 return;
287}
288
310 IN CONST VOID *CallerIdentifier OPTIONAL,
311 IN CONST VOID *Guid OPTIONAL,
312 IN CONST CHAR8 *String OPTIONAL,
313 IN UINT64 Ticker,
314 IN UINT64 Address OPTIONAL,
315 IN UINT16 PerfId,
316 IN PERF_MEASUREMENT_ATTRIBUTE Attribute
317 )
318{
319 FPDT_RECORD_PTR FpdtRecordPtr;
320 CONST VOID *ModuleGuid;
321 CONST CHAR8 *StringPtr;
322 EFI_STATUS Status;
323 UINT64 TimeStamp;
324 FPDT_PEI_EXT_PERF_HEADER *PeiPerformanceLogHeader;
325
326 StringPtr = NULL;
327 FpdtRecordPtr.RecordHeader = NULL;
328 PeiPerformanceLogHeader = NULL;
329
330 //
331 // 1. Get the Perf Id for records from PERF_START/PERF_END, PERF_START_EX/PERF_END_EX.
332 // notes: For other Perf macros (Attribute == PerfEntry), their Id is known.
333 //
334 if (Attribute != PerfEntry) {
335 //
336 // If PERF_START_EX()/PERF_END_EX() have specified the ProgressID,it has high priority.
337 // !!! Note: If the Perf is not the known Token used in the core but have same
338 // ID with the core Token, this case will not be supported.
339 // And in currtnt usage mode, for the unkown ID, there is a general rule:
340 // If it is start pref: the lower 4 bits of the ID should be 0.
341 // If it is end pref: the lower 4 bits of the ID should not be 0.
342 // If input ID doesn't follow the rule, we will adjust it.
343 //
344 if ((PerfId != 0) && (IsKnownID (PerfId)) && (!IsKnownTokens (String))) {
345 return EFI_UNSUPPORTED;
346 } else if ((PerfId != 0) && (!IsKnownID (PerfId)) && (!IsKnownTokens (String))) {
347 if ((Attribute == PerfStartEntry) && ((PerfId & 0x000F) != 0)) {
348 PerfId &= 0xFFF0;
349 } else if ((Attribute == PerfEndEntry) && ((PerfId & 0x000F) == 0)) {
350 PerfId += 1;
351 }
352 } else if (PerfId == 0) {
353 Status = GetFpdtRecordId (Attribute, CallerIdentifier, String, &PerfId);
354 if (EFI_ERROR (Status)) {
355 return Status;
356 }
357 }
358 }
359
360 //
361 // 2. Get the buffer to store the FPDT record.
362 //
363 Status = GetFpdtRecordPtr (PEI_MAX_RECORD_SIZE, &FpdtRecordPtr, &PeiPerformanceLogHeader);
364 if (EFI_ERROR (Status)) {
365 return Status;
366 }
367
368 //
369 // 3 Get the TimeStamp.
370 //
371 if (Ticker == 0) {
372 Ticker = GetPerformanceCounter ();
373 TimeStamp = GetTimeInNanoSecond (Ticker);
374 } else if (Ticker == 1) {
375 TimeStamp = 0;
376 } else {
377 TimeStamp = GetTimeInNanoSecond (Ticker);
378 }
379
380 //
381 // 4.Get the ModuleGuid.
382 //
383 if (CallerIdentifier != NULL) {
384 ModuleGuid = CallerIdentifier;
385 } else {
386 ModuleGuid = &gEfiCallerIdGuid;
387 }
388
389 //
390 // 5. Fill in the FPDT record according to different Performance Identifier.
391 //
392 switch (PerfId) {
393 case MODULE_START_ID:
394 case MODULE_END_ID:
395 StringPtr = PEIM_TOK;
396 if (!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) {
397 FpdtRecordPtr.GuidEvent->Header.Type = FPDT_GUID_EVENT_TYPE;
398 FpdtRecordPtr.GuidEvent->Header.Length = sizeof (FPDT_GUID_EVENT_RECORD);
399 FpdtRecordPtr.GuidEvent->Header.Revision = FPDT_RECORD_REVISION_1;
400 FpdtRecordPtr.GuidEvent->ProgressID = PerfId;
401 FpdtRecordPtr.GuidEvent->Timestamp = TimeStamp;
402 CopyMem (&FpdtRecordPtr.GuidEvent->Guid, ModuleGuid, sizeof (EFI_GUID));
403 }
404
405 break;
406
407 case MODULE_LOADIMAGE_START_ID:
408 case MODULE_LOADIMAGE_END_ID:
409 StringPtr = LOAD_IMAGE_TOK;
410 if (!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) {
411 FpdtRecordPtr.GuidQwordEvent->Header.Type = FPDT_GUID_QWORD_EVENT_TYPE;
412 FpdtRecordPtr.GuidQwordEvent->Header.Length = sizeof (FPDT_GUID_QWORD_EVENT_RECORD);
413 FpdtRecordPtr.GuidQwordEvent->Header.Revision = FPDT_RECORD_REVISION_1;
414 FpdtRecordPtr.GuidQwordEvent->ProgressID = PerfId;
415 FpdtRecordPtr.GuidQwordEvent->Timestamp = TimeStamp;
416 if (PerfId == MODULE_LOADIMAGE_START_ID) {
417 PeiPerformanceLogHeader->LoadImageCount++;
418 }
419
420 FpdtRecordPtr.GuidQwordEvent->Qword = PeiPerformanceLogHeader->LoadImageCount;
421 CopyMem (&FpdtRecordPtr.GuidQwordEvent->Guid, ModuleGuid, sizeof (EFI_GUID));
422 }
423
424 break;
425
426 case PERF_EVENTSIGNAL_START_ID:
427 case PERF_EVENTSIGNAL_END_ID:
428 case PERF_CALLBACK_START_ID:
429 case PERF_CALLBACK_END_ID:
430 if ((String == NULL) || (Guid == NULL)) {
431 return EFI_INVALID_PARAMETER;
432 }
433
434 StringPtr = String;
435 if (AsciiStrLen (String) == 0) {
436 StringPtr = "unknown name";
437 }
438
439 if (!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) {
440 FpdtRecordPtr.DualGuidStringEvent->Header.Type = FPDT_DUAL_GUID_STRING_EVENT_TYPE;
441 FpdtRecordPtr.DualGuidStringEvent->Header.Length = sizeof (FPDT_DUAL_GUID_STRING_EVENT_RECORD);
442 FpdtRecordPtr.DualGuidStringEvent->Header.Revision = FPDT_RECORD_REVISION_1;
443 FpdtRecordPtr.DualGuidStringEvent->ProgressID = PerfId;
444 FpdtRecordPtr.DualGuidStringEvent->Timestamp = TimeStamp;
445 CopyMem (&FpdtRecordPtr.DualGuidStringEvent->Guid1, ModuleGuid, sizeof (FpdtRecordPtr.DualGuidStringEvent->Guid1));
446 CopyMem (&FpdtRecordPtr.DualGuidStringEvent->Guid2, Guid, sizeof (FpdtRecordPtr.DualGuidStringEvent->Guid2));
447 CopyStringIntoPerfRecordAndUpdateLength (FpdtRecordPtr.DualGuidStringEvent->String, StringPtr, &FpdtRecordPtr.DualGuidStringEvent->Header.Length);
448 }
449
450 break;
451
452 case PERF_EVENT_ID:
453 case PERF_FUNCTION_START_ID:
454 case PERF_FUNCTION_END_ID:
455 case PERF_INMODULE_START_ID:
456 case PERF_INMODULE_END_ID:
457 case PERF_CROSSMODULE_START_ID:
458 case PERF_CROSSMODULE_END_ID:
459 if ((String != NULL) && (AsciiStrLen (String) != 0)) {
460 StringPtr = String;
461 } else {
462 StringPtr = "unknown name";
463 }
464
465 if (!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) {
466 FpdtRecordPtr.DynamicStringEvent->Header.Type = FPDT_DYNAMIC_STRING_EVENT_TYPE;
467 FpdtRecordPtr.DynamicStringEvent->Header.Length = sizeof (FPDT_DYNAMIC_STRING_EVENT_RECORD);
468 FpdtRecordPtr.DynamicStringEvent->Header.Revision = FPDT_RECORD_REVISION_1;
469 FpdtRecordPtr.DynamicStringEvent->ProgressID = PerfId;
470 FpdtRecordPtr.DynamicStringEvent->Timestamp = TimeStamp;
471 CopyMem (&FpdtRecordPtr.DynamicStringEvent->Guid, ModuleGuid, sizeof (EFI_GUID));
472 CopyStringIntoPerfRecordAndUpdateLength (FpdtRecordPtr.DynamicStringEvent->String, StringPtr, &FpdtRecordPtr.DynamicStringEvent->Header.Length);
473 }
474
475 break;
476
477 default:
478 if (Attribute != PerfEntry) {
479 if ((String != NULL) && (AsciiStrLen (String) != 0)) {
480 StringPtr = String;
481 } else {
482 StringPtr = "unknown name";
483 }
484
485 if (!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) {
486 FpdtRecordPtr.DynamicStringEvent->Header.Type = FPDT_DYNAMIC_STRING_EVENT_TYPE;
487 FpdtRecordPtr.DynamicStringEvent->Header.Length = sizeof (FPDT_DYNAMIC_STRING_EVENT_RECORD);
488 FpdtRecordPtr.DynamicStringEvent->Header.Revision = FPDT_RECORD_REVISION_1;
489 FpdtRecordPtr.DynamicStringEvent->ProgressID = PerfId;
490 FpdtRecordPtr.DynamicStringEvent->Timestamp = TimeStamp;
491 CopyMem (&FpdtRecordPtr.DynamicStringEvent->Guid, ModuleGuid, sizeof (FpdtRecordPtr.DynamicStringEvent->Guid));
492 CopyStringIntoPerfRecordAndUpdateLength (FpdtRecordPtr.DynamicStringEvent->String, StringPtr, &FpdtRecordPtr.DynamicStringEvent->Header.Length);
493 }
494 } else {
495 return EFI_INVALID_PARAMETER;
496 }
497
498 break;
499 }
500
501 //
502 // 5.2 When PcdEdkiiFpdtStringRecordEnableOnly==TRUE, create string record for all Perf entries.
503 //
504 if (PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) {
505 FpdtRecordPtr.DynamicStringEvent->Header.Type = FPDT_DYNAMIC_STRING_EVENT_TYPE;
506 FpdtRecordPtr.DynamicStringEvent->Header.Length = sizeof (FPDT_DYNAMIC_STRING_EVENT_RECORD);
507 FpdtRecordPtr.DynamicStringEvent->Header.Revision = FPDT_RECORD_REVISION_1;
508 FpdtRecordPtr.DynamicStringEvent->ProgressID = PerfId;
509 FpdtRecordPtr.DynamicStringEvent->Timestamp = TimeStamp;
510 if (Guid != NULL) {
511 //
512 // Cache the event guid in string event record.
513 //
514 CopyMem (&FpdtRecordPtr.DynamicStringEvent->Guid, Guid, sizeof (EFI_GUID));
515 } else {
516 CopyMem (&FpdtRecordPtr.DynamicStringEvent->Guid, ModuleGuid, sizeof (EFI_GUID));
517 }
518
519 CopyStringIntoPerfRecordAndUpdateLength (FpdtRecordPtr.DynamicStringEvent->String, StringPtr, &FpdtRecordPtr.DynamicStringEvent->Header.Length);
520 }
521
522 //
523 // 6. Update the length of the used buffer after fill in the record.
524 //
525 PeiPerformanceLogHeader->SizeOfAllEntries += FpdtRecordPtr.RecordHeader->Length;
526
527 return EFI_SUCCESS;
528}
529
554RETURN_STATUS
555EFIAPI
557 IN CONST VOID *Handle OPTIONAL,
558 IN CONST CHAR8 *Token OPTIONAL,
559 IN CONST CHAR8 *Module OPTIONAL,
560 IN UINT64 TimeStamp,
561 IN UINT32 Identifier
562 )
563{
564 CONST CHAR8 *String;
565
566 if (Token != NULL) {
567 String = Token;
568 } else if (Module != NULL) {
569 String = Module;
570 } else {
571 String = NULL;
572 }
573
574 return (RETURN_STATUS)InsertFpdtRecord (Handle, NULL, String, TimeStamp, 0, (UINT16)Identifier, PerfStartEntry);
575}
576
599RETURN_STATUS
600EFIAPI
602 IN CONST VOID *Handle OPTIONAL,
603 IN CONST CHAR8 *Token OPTIONAL,
604 IN CONST CHAR8 *Module OPTIONAL,
605 IN UINT64 TimeStamp,
606 IN UINT32 Identifier
607 )
608{
609 CONST CHAR8 *String;
610
611 if (Token != NULL) {
612 String = Token;
613 } else if (Module != NULL) {
614 String = Module;
615 } else {
616 String = NULL;
617 }
618
619 return (RETURN_STATUS)InsertFpdtRecord (Handle, NULL, String, TimeStamp, 0, (UINT16)Identifier, PerfEndEntry);
620}
621
665UINTN
666EFIAPI
668 IN UINTN LogEntryKey,
669 OUT CONST VOID **Handle,
670 OUT CONST CHAR8 **Token,
671 OUT CONST CHAR8 **Module,
672 OUT UINT64 *StartTimeStamp,
673 OUT UINT64 *EndTimeStamp,
674 OUT UINT32 *Identifier
675 )
676{
677 return 0;
678}
679
703RETURN_STATUS
704EFIAPI
706 IN CONST VOID *Handle OPTIONAL,
707 IN CONST CHAR8 *Token OPTIONAL,
708 IN CONST CHAR8 *Module OPTIONAL,
709 IN UINT64 TimeStamp
710 )
711{
712 return StartPerformanceMeasurementEx (Handle, Token, Module, TimeStamp, 0);
713}
714
735RETURN_STATUS
736EFIAPI
738 IN CONST VOID *Handle OPTIONAL,
739 IN CONST CHAR8 *Token OPTIONAL,
740 IN CONST CHAR8 *Module OPTIONAL,
741 IN UINT64 TimeStamp
742 )
743{
744 return EndPerformanceMeasurementEx (Handle, Token, Module, TimeStamp, 0);
745}
746
788UINTN
789EFIAPI
791 IN UINTN LogEntryKey,
792 OUT CONST VOID **Handle,
793 OUT CONST CHAR8 **Token,
794 OUT CONST CHAR8 **Module,
795 OUT UINT64 *StartTimeStamp,
796 OUT UINT64 *EndTimeStamp
797 )
798{
799 return 0;
800}
801
814BOOLEAN
815EFIAPI
817 VOID
818 )
819{
820 return (BOOLEAN)((PcdGet8 (PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);
821}
822
838RETURN_STATUS
839EFIAPI
841 IN CONST VOID *CallerIdentifier,
842 IN CONST VOID *Guid OPTIONAL,
843 IN CONST CHAR8 *String OPTIONAL,
844 IN UINT64 Address OPTIONAL,
845 IN UINT32 Identifier
846 )
847{
848 return (RETURN_STATUS)InsertFpdtRecord (CallerIdentifier, Guid, String, 0, Address, (UINT16)Identifier, PerfEntry);
849}
850
863BOOLEAN
864EFIAPI
866 IN CONST UINTN Type
867 )
868{
869 //
870 // When Performance measurement is enabled and the type is not filtered, the performance can be logged.
871 //
872 if (PerformanceMeasurementEnabled () && ((PcdGet8 (PcdPerformanceLibraryPropertyMask) & Type) == 0)) {
873 return TRUE;
874 }
875
876 return FALSE;
877}
UINT64 UINTN
UINT64 EFIAPI GetTimeInNanoSecond(IN UINT64 Ticks)
UINT64 EFIAPI GetPerformanceCounter(VOID)
VOID *EFIAPI GetFirstGuidHob(IN CONST EFI_GUID *Guid)
Definition: HobLib.c:215
VOID *EFIAPI BuildGuidHob(IN CONST EFI_GUID *Guid, IN UINTN DataLength)
Definition: HobLib.c:336
VOID *EFIAPI GetNextGuidHob(IN CONST EFI_GUID *Guid, IN CONST VOID *HobStart)
Definition: HobLib.c:176
RETURN_STATUS EFIAPI AsciiStrnCpyS(OUT CHAR8 *Destination, IN UINTN DestMax, IN CONST CHAR8 *Source, IN UINTN Length)
Definition: SafeString.c:1875
UINTN EFIAPI AsciiStrLen(IN CONST CHAR8 *String)
Definition: String.c:641
INTN EFIAPI AsciiStrCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString)
Definition: String.c:716
UINTN EFIAPI AsciiStrSize(IN CONST CHAR8 *String)
Definition: String.c:681
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
#define DRIVERBINDING_START_TOK
Driver Binding Start() function call.
#define PEI_TOK
PEI Phase.
#define DXE_TOK
DXE Phase.
#define PEIM_TOK
PEIM Modules Entry Point execution.
#define DRIVERBINDING_STOP_TOK
Driver Binding Stop() function call.
#define LOAD_IMAGE_TOK
Load a dispatched module.
#define START_IMAGE_TOK
Dispatched Modules Entry Point execution.
#define BDS_TOK
BDS Phase.
#define DRIVERBINDING_SUPPORT_TOK
Driver Binding Support() function call.
#define SEC_TOK
SEC Phase.
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define PcdGet16(TokenName)
Definition: PcdLib.h:349
#define PcdGet8(TokenName)
Definition: PcdLib.h:336
#define PcdGetBool(TokenName)
Definition: PcdLib.h:401
RETURN_STATUS EFIAPI EndPerformanceMeasurementEx(IN CONST VOID *Handle OPTIONAL, IN CONST CHAR8 *Token OPTIONAL, IN CONST CHAR8 *Module OPTIONAL, IN UINT64 TimeStamp, IN UINT32 Identifier)
UINTN EFIAPI GetPerformanceMeasurement(IN UINTN LogEntryKey, OUT CONST VOID **Handle, OUT CONST CHAR8 **Token, OUT CONST CHAR8 **Module, OUT UINT64 *StartTimeStamp, OUT UINT64 *EndTimeStamp)
VOID CopyStringIntoPerfRecordAndUpdateLength(IN OUT CHAR8 *Destination, IN CONST CHAR8 *Source, IN OUT UINT8 *Length)
EFI_STATUS InsertFpdtRecord(IN CONST VOID *CallerIdentifier OPTIONAL, IN CONST VOID *Guid OPTIONAL, IN CONST CHAR8 *String OPTIONAL, IN UINT64 Ticker, IN UINT64 Address OPTIONAL, IN UINT16 PerfId, IN PERF_MEASUREMENT_ATTRIBUTE Attribute)
RETURN_STATUS EFIAPI StartPerformanceMeasurementEx(IN CONST VOID *Handle OPTIONAL, IN CONST CHAR8 *Token OPTIONAL, IN CONST CHAR8 *Module OPTIONAL, IN UINT64 TimeStamp, IN UINT32 Identifier)
RETURN_STATUS EFIAPI LogPerformanceMeasurement(IN CONST VOID *CallerIdentifier, IN CONST VOID *Guid OPTIONAL, IN CONST CHAR8 *String OPTIONAL, IN UINT64 Address OPTIONAL, IN UINT32 Identifier)
BOOLEAN EFIAPI LogPerformanceMeasurementEnabled(IN CONST UINTN Type)
BOOLEAN IsKnownTokens(IN CONST CHAR8 *Token)
EFI_STATUS GetFpdtRecordPtr(IN UINT8 RecordSize, IN OUT FPDT_RECORD_PTR *FpdtRecordPtr, IN OUT FPDT_PEI_EXT_PERF_HEADER **PeiPerformanceLogHeader)
BOOLEAN EFIAPI PerformanceMeasurementEnabled(VOID)
UINTN EFIAPI GetPerformanceMeasurementEx(IN UINTN LogEntryKey, OUT CONST VOID **Handle, OUT CONST CHAR8 **Token, OUT CONST CHAR8 **Module, OUT UINT64 *StartTimeStamp, OUT UINT64 *EndTimeStamp, OUT UINT32 *Identifier)
RETURN_STATUS EFIAPI EndPerformanceMeasurement(IN CONST VOID *Handle OPTIONAL, IN CONST CHAR8 *Token OPTIONAL, IN CONST CHAR8 *Module OPTIONAL, IN UINT64 TimeStamp)
EFI_STATUS GetFpdtRecordId(IN BOOLEAN Attribute, IN CONST VOID *Handle, IN CONST CHAR8 *String, OUT UINT16 *ProgressID)
BOOLEAN IsKnownID(IN UINT32 Identifier)
RETURN_STATUS EFIAPI StartPerformanceMeasurement(IN CONST VOID *Handle OPTIONAL, IN CONST CHAR8 *Token OPTIONAL, IN CONST CHAR8 *Module OPTIONAL, IN UINT64 TimeStamp)
#define PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
Definition: Base.h:213