]> git.proxmox.com Git - mirror_edk2.git/blobdiff - PerformancePkg/Dp_App/DpProfile.c
Libraries and utilities for instrumenting regions of code and measuring their perform...
[mirror_edk2.git] / PerformancePkg / Dp_App / DpProfile.c
diff --git a/PerformancePkg/Dp_App/DpProfile.c b/PerformancePkg/Dp_App/DpProfile.c
new file mode 100644 (file)
index 0000000..880e057
--- /dev/null
@@ -0,0 +1,92 @@
+/** @file\r
+  * Measured Profiling reporting for the Dp utility.\r
+  *\r
+  * Copyright (c) 2009-2010, Intel Corporation. All rights reserved.<BR>\r
+  * This program and the accompanying materials\r
+  * are licensed and made available under the terms and conditions of the BSD License\r
+  * which accompanies this distribution.  The full text of the license may be found at\r
+  * http://opensource.org/licenses/bsd-license.php\r
+  *\r
+  * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
+\r
+#include <Library/BaseLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/TimerLib.h>\r
+#include <Library/PeCoffGetEntryPointLib.h>\r
+#include <Library/PerformanceLib.h>\r
+#include <Library/PrintLib.h>\r
+#include <Library/HiiLib.h>\r
+#include <Library/PcdLib.h>\r
+\r
+#include <Guid/Performance.h>\r
+\r
+#include "Dp.h"\r
+#include "Literals.h"\r
+#include "DpInternal.h"\r
+\r
+/** Gather and print ALL Profiling Records.\r
+  *\r
+  * Displays all "interesting" Profile measurements in order.\r
+  * The number of records displayed is controlled by:\r
+  *   - records with a duration less than mInterestThreshold microseconds are not displayed.\r
+  *   - No more than Limit records are displayed.  A Limit of zero will not limit the output.\r
+  *   - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not\r
+  *     displayed.\r
+  *\r
+  * @pre    The mInterestThreshold global variable is set to the shortest duration to be printed.\r
+  *         The mGaugeString and mUnicodeToken global arrays are used for temporary string storage.\r
+  *         They must not be in use by a calling function.\r
+  *\r
+  * @param[in]    Limit         The number of records to print.  Zero is ALL.\r
+  * @param[in]    ExcludeFlag   TRUE to exclude individual Cumulative items from display.\r
+  *\r
+**/\r
+VOID\r
+DumpAllProfile(\r
+  IN UINTN      Limit,\r
+  IN BOOLEAN    ExcludeFlag\r
+  )\r
+{\r
+  EFI_STRING    StringPtr;\r
+\r
+  StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_PROFILE), NULL);\r
+  PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),\r
+              (StringPtr == NULL) ? ALit_UNKNOWN: StringPtr);\r
+  return;\r
+}\r
+\r
+/** Gather and print Raw Profile Records.\r
+  *\r
+  * All Profile measurements with a duration greater than or equal to\r
+  * mInterestThreshold are printed without interpretation.\r
+  *\r
+  * The number of records displayed is controlled by:\r
+  *   - records with a duration less than mInterestThreshold microseconds are not displayed.\r
+  *   - No more than Limit records are displayed.  A Limit of zero will not limit the output.\r
+  *   - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not\r
+  *     displayed.\r
+  *\r
+  * @pre    The mInterestThreshold global variable is set to the shortest duration to be printed.\r
+  *\r
+  * @param[in]    Limit         The number of records to print.  Zero is ALL.\r
+  * @param[in]    ExcludeFlag   TRUE to exclude individual Cumulative items from display.\r
+  *\r
+**/\r
+VOID\r
+DumpRawProfile(\r
+  IN UINTN      Limit,\r
+  IN BOOLEAN    ExcludeFlag\r
+  )\r
+{\r
+  EFI_STRING    StringPtr;\r
+\r
+  StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWPROFILE), NULL);\r
+  PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),\r
+              (StringPtr == NULL) ? ALit_UNKNOWN: StringPtr);\r
+  return;\r
+}\r