1 | /** @file
|
---|
2 | Measured Profiling reporting for the Dp 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 | #include <Library/BaseLib.h>
|
---|
15 | #include <Library/BaseMemoryLib.h>
|
---|
16 | #include <Library/MemoryAllocationLib.h>
|
---|
17 | #include <Library/DebugLib.h>
|
---|
18 | #include <Library/UefiBootServicesTableLib.h>
|
---|
19 | #include <Library/TimerLib.h>
|
---|
20 | #include <Library/PeCoffGetEntryPointLib.h>
|
---|
21 | #include <Library/PerformanceLib.h>
|
---|
22 | #include <Library/PrintLib.h>
|
---|
23 | #include <Library/HiiLib.h>
|
---|
24 | #include <Library/PcdLib.h>
|
---|
25 |
|
---|
26 | #include <Guid/Performance.h>
|
---|
27 |
|
---|
28 | #include "Dp.h"
|
---|
29 | #include "Literals.h"
|
---|
30 | #include "DpInternal.h"
|
---|
31 |
|
---|
32 | /**
|
---|
33 | Gather and print ALL Profiling Records.
|
---|
34 |
|
---|
35 | Displays all "interesting" Profile measurements in order.
|
---|
36 | The number of records displayed is controlled by:
|
---|
37 | - records with a duration less than mInterestThreshold microseconds are not displayed.
|
---|
38 | - No more than Limit records are displayed. A Limit of zero will not limit the output.
|
---|
39 | - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
|
---|
40 | displayed.
|
---|
41 |
|
---|
42 | @pre The mInterestThreshold global variable is set to the shortest duration to be printed.
|
---|
43 | The mGaugeString and mUnicodeToken global arrays are used for temporary string storage.
|
---|
44 | They must not be in use by a calling function.
|
---|
45 |
|
---|
46 | @param[in] Limit The number of records to print. Zero is ALL.
|
---|
47 | @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
|
---|
48 |
|
---|
49 | **/
|
---|
50 | VOID
|
---|
51 | DumpAllProfile(
|
---|
52 | IN UINTN Limit,
|
---|
53 | IN BOOLEAN ExcludeFlag
|
---|
54 | )
|
---|
55 | {
|
---|
56 | EFI_STRING StringPtr;
|
---|
57 | EFI_STRING StringPtrUnknown;
|
---|
58 |
|
---|
59 | StringPtrUnknown = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
---|
60 | StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_PROFILE), NULL);
|
---|
61 |
|
---|
62 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDpHiiHandle,
|
---|
63 | (StringPtr == NULL) ? StringPtrUnknown: StringPtr);
|
---|
64 | FreePool (StringPtr);
|
---|
65 | FreePool (StringPtrUnknown);
|
---|
66 | }
|
---|
67 |
|
---|
68 | /**
|
---|
69 | Gather and print Raw Profile Records.
|
---|
70 |
|
---|
71 | All Profile measurements with a duration greater than or equal to
|
---|
72 | mInterestThreshold are printed without interpretation.
|
---|
73 |
|
---|
74 | The number of records displayed is controlled by:
|
---|
75 | - records with a duration less than mInterestThreshold microseconds are not displayed.
|
---|
76 | - No more than Limit records are displayed. A Limit of zero will not limit the output.
|
---|
77 | - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
|
---|
78 | displayed.
|
---|
79 |
|
---|
80 | @pre The mInterestThreshold global variable is set to the shortest duration to be printed.
|
---|
81 |
|
---|
82 | @param[in] Limit The number of records to print. Zero is ALL.
|
---|
83 | @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
|
---|
84 |
|
---|
85 | **/
|
---|
86 | VOID
|
---|
87 | DumpRawProfile(
|
---|
88 | IN UINTN Limit,
|
---|
89 | IN BOOLEAN ExcludeFlag
|
---|
90 | )
|
---|
91 | {
|
---|
92 | EFI_STRING StringPtr;
|
---|
93 | EFI_STRING StringPtrUnknown;
|
---|
94 |
|
---|
95 | StringPtrUnknown = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
|
---|
96 | StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWPROFILE), NULL);
|
---|
97 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDpHiiHandle,
|
---|
98 | (StringPtr == NULL) ? StringPtrUnknown: StringPtr);
|
---|
99 | FreePool (StringPtr);
|
---|
100 | FreePool (StringPtrUnknown);
|
---|
101 | }
|
---|