• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   Measured Profiling reporting for the Dp utility.
3 
4   Copyright (c) 2009 - 2010, 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 #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
DumpAllProfile(IN UINTN Limit,IN BOOLEAN ExcludeFlag)51 DumpAllProfile(
52   IN UINTN      Limit,
53   IN BOOLEAN    ExcludeFlag
54   )
55 {
56   EFI_STRING    StringPtr;
57   EFI_STRING    StringPtrUnknown;
58 
59   StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
60   StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_PROFILE), NULL);
61 
62   PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),
63               (StringPtr == NULL) ? StringPtrUnknown: StringPtr);
64   FreePool (StringPtr);
65   FreePool (StringPtrUnknown);
66   return;
67 }
68 
69 /**
70   Gather and print Raw Profile Records.
71 
72   All Profile measurements with a duration greater than or equal to
73   mInterestThreshold are printed without interpretation.
74 
75   The number of records displayed is controlled by:
76      - records with a duration less than mInterestThreshold microseconds are not displayed.
77      - No more than Limit records are displayed.  A Limit of zero will not limit the output.
78      - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
79        displayed.
80 
81   @pre    The mInterestThreshold global variable is set to the shortest duration to be printed.
82 
83   @param[in]    Limit         The number of records to print.  Zero is ALL.
84   @param[in]    ExcludeFlag   TRUE to exclude individual Cumulative items from display.
85 
86 **/
87 VOID
DumpRawProfile(IN UINTN Limit,IN BOOLEAN ExcludeFlag)88 DumpRawProfile(
89   IN UINTN      Limit,
90   IN BOOLEAN    ExcludeFlag
91   )
92 {
93   EFI_STRING    StringPtr;
94   EFI_STRING    StringPtrUnknown;
95 
96   StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
97   StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWPROFILE), NULL);
98   PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),
99               (StringPtr == NULL) ? StringPtrUnknown: StringPtr);
100   FreePool (StringPtr);
101   FreePool (StringPtrUnknown);
102   return;
103 }
104