Vishal Bhoj | 82c8071 | 2015-12-15 21:13:33 +0530 | [diff] [blame^] | 1 | /** @file
|
| 2 | If the Variable services have PcdVariableCollectStatistics set to TRUE then
|
| 3 | the EFI system table will contain statistical information about variable usage
|
| 4 | an this utility will print out the information. You can use console redirection
|
| 5 | to capture the data.
|
| 6 |
|
| 7 | Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.<BR>
|
| 8 | This program and the accompanying materials
|
| 9 | are licensed and made available under the terms and conditions of the BSD License
|
| 10 | which accompanies this distribution. The full text of the license may be found at
|
| 11 | http://opensource.org/licenses/bsd-license.php
|
| 12 |
|
| 13 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
| 14 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
| 15 |
|
| 16 | **/
|
| 17 |
|
| 18 | #include <Uefi.h>
|
| 19 | #include <Library/UefiLib.h>
|
| 20 | #include <Library/UefiApplicationEntryPoint.h>
|
| 21 | #include <Guid/VariableFormat.h>
|
| 22 |
|
| 23 |
|
| 24 | /**
|
| 25 | The user Entry Point for Application. The user code starts with this function
|
| 26 | as the real entry point for the image goes into a library that calls this
|
| 27 | function.
|
| 28 |
|
| 29 |
|
| 30 | @param[in] ImageHandle The firmware allocated handle for the EFI image.
|
| 31 | @param[in] SystemTable A pointer to the EFI System Table.
|
| 32 |
|
| 33 | @retval EFI_SUCCESS The entry point is executed successfully.
|
| 34 | @retval other Some error occurs when executing this entry point.
|
| 35 |
|
| 36 | **/
|
| 37 | EFI_STATUS
|
| 38 | EFIAPI
|
| 39 | UefiMain (
|
| 40 | IN EFI_HANDLE ImageHandle,
|
| 41 | IN EFI_SYSTEM_TABLE *SystemTable
|
| 42 | )
|
| 43 | {
|
| 44 | EFI_STATUS Status;
|
| 45 | VARIABLE_INFO_ENTRY *VariableInfo;
|
| 46 | VARIABLE_INFO_ENTRY *Entry;
|
| 47 |
|
| 48 | Status = EfiGetSystemConfigurationTable (&gEfiVariableGuid, (VOID **)&Entry);
|
| 49 | if (!EFI_ERROR (Status) && (Entry != NULL)) {
|
| 50 | Print (L"Non-Volatile EFI Variables:\n");
|
| 51 | VariableInfo = Entry;
|
| 52 | do {
|
| 53 | if (!VariableInfo->Volatile) {
|
| 54 | Print (
|
| 55 | L"%g R%03d(%03d) W%03d D%03d:%s\n",
|
| 56 | &VariableInfo->VendorGuid,
|
| 57 | VariableInfo->ReadCount,
|
| 58 | VariableInfo->CacheCount,
|
| 59 | VariableInfo->WriteCount,
|
| 60 | VariableInfo->DeleteCount,
|
| 61 | VariableInfo->Name
|
| 62 | );
|
| 63 | }
|
| 64 |
|
| 65 | VariableInfo = VariableInfo->Next;
|
| 66 | } while (VariableInfo != NULL);
|
| 67 |
|
| 68 | Print (L"Volatile EFI Variables:\n");
|
| 69 | VariableInfo = Entry;
|
| 70 | do {
|
| 71 | if (VariableInfo->Volatile) {
|
| 72 | Print (
|
| 73 | L"%g R%03d(%03d) W%03d D%03d:%s\n",
|
| 74 | &VariableInfo->VendorGuid,
|
| 75 | VariableInfo->ReadCount,
|
| 76 | VariableInfo->CacheCount,
|
| 77 | VariableInfo->WriteCount,
|
| 78 | VariableInfo->DeleteCount,
|
| 79 | VariableInfo->Name
|
| 80 | );
|
| 81 | }
|
| 82 | VariableInfo = VariableInfo->Next;
|
| 83 | } while (VariableInfo != NULL);
|
| 84 |
|
| 85 | } else {
|
| 86 | Print (L"Warning: Variable Dxe driver doesn't enable the feature of statistical information!\n");
|
| 87 | Print (L"If you want to see this info, please:\n");
|
| 88 | Print (L" 1. Set PcdVariableCollectStatistics as TRUE\n");
|
| 89 | Print (L" 2. Rebuild Variable Dxe driver\n");
|
| 90 | Print (L" 3. Run \"VariableInfo\" cmd again\n");
|
| 91 |
|
| 92 | }
|
| 93 |
|
| 94 | return Status;
|
| 95 | }
|