/** @file
Shell application for Displaying Performance Metrics.
The Dp application reads performance data and presents it in several
different formats depending upon the needs of the user. Both
Trace and Measured Profiling information is processed and presented.
Dp uses the "PerformanceLib" to read the measurement records.
The "TimerLib" provides information about the timer, such as frequency,
beginning, and ending counter values.
Measurement records contain identifying information (Handle, Token, Module)
and start and end time values.
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 - 2012, 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
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/UefiApplicationEntryPoint.h>
#include <Library/ShellLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
#include <Library/TimerLib.h>
#include <Guid/Performance.h>
#include <PerformanceTokens.h>
#include "Dp.h"
#include "Literals.h"
#include "DpInternal.h"
//
/// Module-Global Variables
///@{
/// Timer Specific Information.
/// Items for which to gather cumulative statistics.
};
/// Number of items for which we are gathering cumulative statistics.
#endif
};
///@}
/**
Transfer the param list value and get the command line parse.
**/
InitialShellParamList( void )
{
//
// Allocate one more for the end tag.
//
{
}
}
/**
Display Usage and Help information.
**/
ShowHelp( void )
{
#else
#endif // PROFILING_IMPLEMENTED
#endif // PROFILING_IMPLEMENTED
Print(L"\n");
}
/**
Display the trailing Verbose information.
**/
DumpStatistics( void )
{
PrintToken( STRING_TOKEN (STR_DP_STATS_NUMHANDLES), SummaryData.NumHandles, SummaryData.NumTrace - SummaryData.NumHandles);
#endif // PROFILING_IMPLEMENTED
}
/**
Dump performance data.
@param[in] ImageHandle The image handle.
@param[in] SystemTable The system table.
@retval EFI_SUCCESS Command completed successfully.
@retval EFI_INVALID_PARAMETER Command usage error.
@retval value Unknown error.
**/
)
{
SummaryMode = FALSE;
VerboseMode = FALSE;
ProfileMode = FALSE;
ExcludeMode = FALSE;
// Get DP's entry time as soon as possible.
// This is used as the Shell-Phase end time.
//
Ticker = GetPerformanceCounter ();
// Register our string package with HII and return the handle to it.
//
// Initial the command list
//
/****************************************************************************
**** Process Command Line arguments ****
****************************************************************************/
ShowHelp();
}
else {
{
ShowHelp();
}
else {
// Boolean Options
//
#endif // PROFILING_IMPLEMENTED
// Options with Values
if (CmdLineArg == NULL) {
}
else {
if (Number2Display == 0) {
}
}
if (CmdLineArg == NULL) {
}
else {
}
// Handle Flag combinations and default behaviors
// If both TraceMode and ProfileMode are FALSE, set them both to TRUE
if ((! TraceMode) && (! ProfileMode)) {
ProfileMode = TRUE;
#endif // PROFILING_IMPLEMENTED
}
/****************************************************************************
**** Timer specific processing ****
****************************************************************************/
// Get the Performance counter characteristics:
// Freq = Frequency in Hz
// StartCount = Value loaded into the counter when it starts counting
// EndCount = Value counter counts to before it needs to be reset
//
// Convert the Frequency from Hz to KHz
// Determine in which direction the performance counter counts.
/****************************************************************************
**** Print heading ****
****************************************************************************/
// print DP's build version
// print performance timer characteristics
if ((VerboseMode) &&
(! RawMode)
) {
NULL);
);
}
/* **************************************************************************
**** Print Sections based on command line options
****
**** Option modes have the following priority:
**** v Verbose -- Valid in combination with any other options
**** t Threshold -- Modifies All, Raw, and Cooked output
**** Default is 0 for All and Raw mode
**** Default is DEFAULT_THRESHOLD for "Cooked" mode
**** n Number2Display Used by All and Raw mode. Otherwise ignored.
**** A All -- R and S options are ignored
**** R Raw -- S option is ignored
**** s Summary -- Modifies "Cooked" output only
**** Cooked (Default)
****
**** The All, Raw, and Cooked modes are modified by the Trace and Profile
**** options.
**** !T && !P := (0) Default, Both are displayed
**** T && !P := (1) Only Trace records are displayed
**** !T && P := (2) Only Profile records are displayed
**** T && P := (3) Same as Default, both are displayed
****************************************************************************/
if (AllMode) {
if (TraceMode) {
}
if (ProfileMode) {
}
}
else if (RawMode) {
if (TraceMode) {
}
if (ProfileMode) {
}
}
else {
//------------- Begin Cooked Mode Processing
if (TraceMode) {
ProcessPhases ( Ticker );
if ( ! SummaryMode) {
ProcessPeims ( );
ProcessGlobal ( );
}
}
}
if (ProfileMode) {
}
} //------------- End of Cooked Mode Processing
if ( VerboseMode || SummaryMode) {
}
}
}
// Free the memory allocate from HiiGetString
//
ListIndex = 0;
ListIndex ++;
}
return Status;
}