aboutsummaryrefslogtreecommitdiffstats
path: root/roms/edk2/MdePkg/Library/BaseLib/Ia32/ReadPmc.c
diff options
context:
space:
mode:
Diffstat (limited to 'roms/edk2/MdePkg/Library/BaseLib/Ia32/ReadPmc.c')
-rw-r--r--roms/edk2/MdePkg/Library/BaseLib/Ia32/ReadPmc.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/roms/edk2/MdePkg/Library/BaseLib/Ia32/ReadPmc.c b/roms/edk2/MdePkg/Library/BaseLib/Ia32/ReadPmc.c
new file mode 100644
index 000000000..cc09ed700
--- /dev/null
+++ b/roms/edk2/MdePkg/Library/BaseLib/Ia32/ReadPmc.c
@@ -0,0 +1,31 @@
+/** @file
+ AsmReadPmc function
+
+ Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+/**
+ Reads the current value of a Performance Counter (PMC).
+
+ Reads and returns the current value of performance counter specified by
+ Index. This function is only available on IA-32 and x64.
+
+ @param Index The 32-bit Performance Counter index to read.
+
+ @return The value of the PMC specified by Index.
+
+**/
+UINT64
+EFIAPI
+AsmReadPmc (
+ IN UINT32 Index
+ )
+{
+ _asm {
+ mov ecx, Index
+ rdpmc
+ }
+}
+