]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Variable/Application/VariableInfo.c
Add Profiling support for Variable store and added a specialized caching algorithm
[mirror_edk2.git] / MdeModulePkg / Universal / Variable / Application / VariableInfo.c
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
8 All rights reserved. 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/DebugLib.h>
20 #include <Library/UefiLib.h>
21 #include <Library/UefiApplicationEntryPoint.h>
22 #include <Library/UefiBootServicesTableLib.h>
23 #include <Guid/VariableInfo.h>
24
25
26 /**
27 The user Entry Point for Application. The user code starts with this function
28 as the real entry point for the image goes into a library that calls this
29 function.
30
31
32 @param[in] ImageHandle The firmware allocated handle for the EFI image.
33 @param[in] SystemTable A pointer to the EFI System Table.
34
35 @retval EFI_SUCCESS The entry point is executed successfully.
36 @retval other Some error occurs when executing this entry point.
37
38 **/
39 EFI_STATUS
40 EFIAPI
41 UefiMain (
42 IN EFI_HANDLE ImageHandle,
43 IN EFI_SYSTEM_TABLE *SystemTable
44 )
45 {
46 EFI_STATUS Status;
47 VARIABLE_INFO_ENTRY *VariableInfo;
48 VARIABLE_INFO_ENTRY *Entry;
49
50 Status = EfiGetSystemConfigurationTable (&gEfiVariableInfoGuid, (VOID **)&Entry);
51 if (!EFI_ERROR (Status) && (Entry != NULL)) {
52 Print (L"Non-Volatile EFI Variables:\n");
53 VariableInfo = Entry;
54 do {
55 if (!VariableInfo->Volatile) {
56 Print (
57 L"%g R%03d(%03d) W%03d D%03d:%s\n",
58 &VariableInfo->VendorGuid,
59 VariableInfo->ReadCount,
60 VariableInfo->CacheCount,
61 VariableInfo->WriteCount,
62 VariableInfo->DeleteCount,
63 VariableInfo->Name
64 );
65 }
66
67 VariableInfo = VariableInfo->Next;
68 } while (VariableInfo != NULL);
69
70 Print (L"Volatile EFI Variables:\n");
71 VariableInfo = Entry;
72 do {
73 if (VariableInfo->Volatile) {
74 Print (
75 L"%g R%03d(%03d) W%03d D%03d:%s\n",
76 &VariableInfo->VendorGuid,
77 VariableInfo->ReadCount,
78 VariableInfo->CacheCount,
79 VariableInfo->WriteCount,
80 VariableInfo->DeleteCount,
81 VariableInfo->Name
82 );
83 }
84 VariableInfo = VariableInfo->Next;
85 } while (VariableInfo != NULL);
86
87 }
88
89 return EFI_SUCCESS;
90 }