summaryrefslogtreecommitdiffstats
path: root/PerformancePkg
diff options
context:
space:
mode:
Diffstat (limited to 'PerformancePkg')
-rw-r--r--PerformancePkg/Dp_App/Dp.c66
-rw-r--r--PerformancePkg/Dp_App/Dp.inf9
-rw-r--r--PerformancePkg/Dp_App/DpStrings.uni68
3 files changed, 123 insertions, 20 deletions
diff --git a/PerformancePkg/Dp_App/Dp.c b/PerformancePkg/Dp_App/Dp.c
index b24a0de72d..283b61ccd4 100644
--- a/PerformancePkg/Dp_App/Dp.c
+++ b/PerformancePkg/Dp_App/Dp.c
@@ -13,7 +13,7 @@
Dp uses this information to group records in different ways. It also uses
timer information to calculate elapsed time for each measurement.
- Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -25,12 +25,14 @@
**/
#include <Library/UefiApplicationEntryPoint.h>
+#include <Library/UefiBootServicesTableLib.h>
#include <Library/ShellLib.h>
#include <Library/BaseLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
#include <Library/TimerLib.h>
#include <Library/UefiLib.h>
+#include <Library/UefiHiiServicesLib.h>
#include <Library/HiiLib.h>
#include <Library/PcdLib.h>
@@ -42,6 +44,16 @@
#include "DpInternal.h"
//
+// String token ID of help message text.
+// Shell supports to find help message in the resource section of an application image if
+// .MAN file is not found. This global variable is added to make build tool recognizes
+// that the help string is consumed by user and then build tool will add the string into
+// the resource section. Thus the application can use '-?' option to show help message in
+// Shell.
+//
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mDpStrEngHelpTokenId = STRING_TOKEN (STR_DP_HELP_INFORMATION);
+
+//
/// Module-Global Variables
///@{
EFI_HII_HANDLE gHiiHandle;
@@ -217,17 +229,18 @@ InitializeDp (
EFI_STRING StringPtr;
UINTN Number2Display;
- EFI_STATUS Status;
- BOOLEAN SummaryMode;
- BOOLEAN VerboseMode;
- BOOLEAN AllMode;
- BOOLEAN RawMode;
- BOOLEAN TraceMode;
- BOOLEAN ProfileMode;
- BOOLEAN ExcludeMode;
- BOOLEAN CumulativeMode;
- CONST CHAR16 *CustomCumulativeToken;
- PERF_CUM_DATA *CustomCumulativeData;
+ EFI_STATUS Status;
+ BOOLEAN SummaryMode;
+ BOOLEAN VerboseMode;
+ BOOLEAN AllMode;
+ BOOLEAN RawMode;
+ BOOLEAN TraceMode;
+ BOOLEAN ProfileMode;
+ BOOLEAN ExcludeMode;
+ BOOLEAN CumulativeMode;
+ CONST CHAR16 *CustomCumulativeToken;
+ PERF_CUM_DATA *CustomCumulativeData;
+ EFI_HII_PACKAGE_LIST_HEADER *PackageList;
EFI_STRING StringDpOptionQh;
EFI_STRING StringDpOptionLh;
@@ -277,10 +290,35 @@ InitializeDp (
//
Ticker = GetPerformanceCounter ();
- // Register our string package with HII and return the handle to it.
//
- gHiiHandle = HiiAddPackages (&gEfiCallerIdGuid, ImageHandle, DPStrings, NULL);
+ // Retrieve HII package list from ImageHandle
+ //
+ Status = gBS->OpenProtocol (
+ ImageHandle,
+ &gEfiHiiPackageListProtocolGuid,
+ (VOID **) &PackageList,
+ ImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ //
+ // Publish HII package list to HII Database.
+ //
+ Status = gHiiDatabase->NewPackageList (
+ gHiiDatabase,
+ PackageList,
+ NULL,
+ &gHiiHandle
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
ASSERT (gHiiHandle != NULL);
+
// Initial the command list
//
diff --git a/PerformancePkg/Dp_App/Dp.inf b/PerformancePkg/Dp_App/Dp.inf
index 1c62fb1dd6..8abc20f168 100644
--- a/PerformancePkg/Dp_App/Dp.inf
+++ b/PerformancePkg/Dp_App/Dp.inf
@@ -1,7 +1,7 @@
## @file
# Display Performance Application, Module information file.
#
-# Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2009 - 2016, 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
@@ -19,6 +19,11 @@
MODULE_TYPE = UEFI_APPLICATION
VERSION_STRING = 1.0
ENTRY_POINT = InitializeDp
+
+#
+# This flag specifies whether HII resource section is generated into PE image.
+#
+ UEFI_HII_RESOURCE_SECTION = TRUE
#
# The following information is for reference only and not required by the build tools.
@@ -57,12 +62,14 @@
PrintLib
UefiLib
HiiLib
+ UefiHiiServicesLib
PcdLib
DevicePathLib
DxeServicesLib
[Protocols]
gEfiLoadedImageProtocolGuid ## CONSUMES
+ gEfiHiiPackageListProtocolGuid ## CONSUMES
gEfiDriverBindingProtocolGuid ## SOMETIMES_CONSUMES
gEfiComponentName2ProtocolGuid ## SOMETIMES_CONSUMES
gEfiLoadedImageDevicePathProtocolGuid ## SOMETIMES_CONSUMES
diff --git a/PerformancePkg/Dp_App/DpStrings.uni b/PerformancePkg/Dp_App/DpStrings.uni
index f368f3463f..daaa242e3d 100644
--- a/PerformancePkg/Dp_App/DpStrings.uni
+++ b/PerformancePkg/Dp_App/DpStrings.uni
@@ -1,6 +1,6 @@
// *++
//
-// Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+// Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
// (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
// This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License
@@ -28,12 +28,70 @@
#langdef en-US "English"
#langdef fr-FR "Français"
+#string STR_DP_HELP_INFORMATION #language en-US ""
+ ".TH DP 0 "Display Performance metrics."\r\n"
+ ".SH NAME\r\n"
+ "Display Performance metrics.\r\n"
+ ".SH SYNOPSIS\r\n"
+ " \r\n"
+ "If Profiling is implemented:\r\n"
+ "dp [-b] [-v] [-x] [-s | -A | -R] [-T] [-P] [-t value] [-n count] [-c [token]] [-i] [-?]\r\n"
+ "If Profiling is not implemented:\r\n"
+ "dp [-b] [-v] [-x] [-s | -A | -R] [-t value] [-n count] [-c [token]] [-i] [-?]\r\n"
+ ".SH OPTIONS\r\n"
+ " \r\n"
+ " -b display on multiple pages\n\r\n"
+ " -v display additional information\r\n"
+ " -x prevent display of individual measurements for cumulative items\r\n"
+ " -s display summary information only\r\n"
+ " -A display all measurements in a list\r\n"
+ " -R display all measurements in raw format\r\n"
+ " -T display Trace measurements only(This option is available when Profiling is implemented)\r\n"
+ " -P display Profile measurements only(This option is available when Profiling is implemented)\r\n"
+ " -t VALUE Set display threshold to VALUE microseconds\r\n"
+ " -n COUNT Limit display to COUNT lines in All and Raw modes\r\n"
+ " -i display identifier\r\n"
+ " -c TOKEN - Display pre-defined and custom cumulative data\r\n"
+ " Pre-defined cumulative token are:\r\n"
+ " 1. LoadImage:\r\n"
+ " 2. StartImage:\r\n"
+ " 3. DB:Start:\r\n"
+ " 4. DB:Support:\r\n"
+ " -? display dp help information\r\n"
+ "\r\n"
+ #language fr-FR ""
+ ".TH DP 0 "Montrer les données d'exécution"\r\n"
+ ".SH NAME\r\n"
+ "Montrer les données d'exécution\r\n"
+ ".SH SYNOPSIS\r\n"
+ " \r\n"
+ "If Profiling is implemented:\r\n"
+ "dp [-b] [-v] [-x] [-s | -A | -R] [-T] [-P] [-t value] [-n count] [-c [token]] [-i] [-?]\r\n"
+ "If Profiling is not implemented:\r\n"
+ "dp [-b] [-v] [-x] [-s | -A | -R] [-t value] [-n count] [-c [token]] [-i] [-?]\r\n"
+ ".SH OPTIONS\r\n"
+ " \r\n"
+ " -b montrer sur les pages multiples\r\n"
+ " -v display additional information\r\n"
+ " -x prevent display of individual measurements for cumulative items\r\n"
+ " -s montrer les données de statistique seulement\r\n"
+ " -A\r\n"
+ " -R\r\n"
+ " -T\r\n"
+ " -P\r\n"
+ " -t VALUE\r\n"
+ " -n COUNT\r\n"
+ " -i\r\n"
+ " -c\r\n"
+ " -? montrer dp aider l'information\r\n"
+ "\r\n"
+
#string STR_DP_HELP_HEAD #language en-US "\nDisplay Performance metrics\n"
#language fr-FR "\nMontrer les données d'exécution\n"
-#string STR_DP_HELP_FLAGS #language en-US "dp [-b] [-v] [-x] [-s | -A | -R] [-T] [-P] [-t value] [-n count] [-c [token]] [-i] [-h | -?]\n"
- #language fr-FR "dp [-b] [-v] [-x] [-s | -A | -R] [-T] [-P] [-t value] [-n count] [-c [token]] [-i] [-h | -?]\n"
-#string STR_DP_HELP_FLAGS_2 #language en-US "dp [-b] [-v] [-x] [-s | -A | -R] [-t value] [-n count] [-c [token]] [-i] [-h | -?]\n"
- #language fr-FR "dp [-b] [-v] [-x] [-s | -A | -R] [-t value] [-n count] [-c [token]] [-i] [-h | -?]\n"
+#string STR_DP_HELP_FLAGS #language en-US "dp [-b] [-v] [-x] [-s | -A | -R] [-T] [-P] [-t value] [-n count] [-c [token]] [-i] [-?]\n"
+ #language fr-FR "dp [-b] [-v] [-x] [-s | -A | -R] [-T] [-P] [-t value] [-n count] [-c [token]] [-i] [-?]\n"
+#string STR_DP_HELP_FLAGS_2 #language en-US "dp [-b] [-v] [-x] [-s | -A | -R] [-t value] [-n count] [-c [token]] [-i] [-?]\n"
+ #language fr-FR "dp [-b] [-v] [-x] [-s | -A | -R] [-t value] [-n count] [-c [token]] [-i] [-?]\n"
#string STR_DP_HELP_PAGINATE #language en-US " -b display on multiple pages\n"
#language fr-FR " -b montrer sur les pages multiples\n"
#string STR_DP_HELP_VERBOSE #language en-US " -v display additional information\n"