summaryrefslogtreecommitdiff
path: root/PerformancePkg/Dp_App/DpProfile.c
blob: 880e057e7c63027f4f27394390292897f4f82afe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/** @file
  * Measured Profiling reporting for the Dp utility.
  *
  * Copyright (c) 2009-2010, Intel Corporation. All rights reserved.<BR>
  * This program and the accompanying materials
  * are licensed and made available under the terms and conditions of the BSD License
  * which accompanies this distribution.  The full text of the license may be found at
  * http://opensource.org/licenses/bsd-license.php
  *
  * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/

#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/TimerLib.h>
#include <Library/PeCoffGetEntryPointLib.h>
#include <Library/PerformanceLib.h>
#include <Library/PrintLib.h>
#include <Library/HiiLib.h>
#include <Library/PcdLib.h>

#include <Guid/Performance.h>

#include "Dp.h"
#include "Literals.h"
#include "DpInternal.h"

/** Gather and print ALL Profiling Records.
  *
  * Displays all "interesting" Profile measurements in order.
  * The number of records displayed is controlled by:
  *   - records with a duration less than mInterestThreshold microseconds are not displayed.
  *   - No more than Limit records are displayed.  A Limit of zero will not limit the output.
  *   - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
  *     displayed.
  *
  * @pre    The mInterestThreshold global variable is set to the shortest duration to be printed.
  *         The mGaugeString and mUnicodeToken global arrays are used for temporary string storage.
  *         They must not be in use by a calling function.
  *
  * @param[in]    Limit         The number of records to print.  Zero is ALL.
  * @param[in]    ExcludeFlag   TRUE to exclude individual Cumulative items from display.
  *
**/
VOID
DumpAllProfile(
  IN UINTN      Limit,
  IN BOOLEAN    ExcludeFlag
  )
{
  EFI_STRING    StringPtr;

  StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_PROFILE), NULL);
  PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),
              (StringPtr == NULL) ? ALit_UNKNOWN: StringPtr);
  return;
}

/** Gather and print Raw Profile Records.
  *
  * All Profile measurements with a duration greater than or equal to
  * mInterestThreshold are printed without interpretation.
  *
  * The number of records displayed is controlled by:
  *   - records with a duration less than mInterestThreshold microseconds are not displayed.
  *   - No more than Limit records are displayed.  A Limit of zero will not limit the output.
  *   - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
  *     displayed.
  *
  * @pre    The mInterestThreshold global variable is set to the shortest duration to be printed.
  *
  * @param[in]    Limit         The number of records to print.  Zero is ALL.
  * @param[in]    ExcludeFlag   TRUE to exclude individual Cumulative items from display.
  *
**/
VOID
DumpRawProfile(
  IN UINTN      Limit,
  IN BOOLEAN    ExcludeFlag
  )
{
  EFI_STRING    StringPtr;

  StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWPROFILE), NULL);
  PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),
              (StringPtr == NULL) ? ALit_UNKNOWN: StringPtr);
  return;
}