Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ep:labs:03:contents:tasks:ex5 [2025/03/05 12:25]
radu.mantu
ep:labs:03:contents:tasks:ex5 [2025/05/06 10:27] (current)
radu.mantu
Line 1: Line 1:
 ==== 05. [10p] Bonus - Hardware Counters ==== ==== 05. [10p] Bonus - Hardware Counters ====
 +
 +<​note>​
 +Solve the rest of the lab within the allotted time to unlock this bonus exercise ;)
 +</​note>​
  
 A significant portion of the system statistics that can be generated involve hardware counters. As the name implies, these are special registers that count the number of occurrences of specific events in the CPU. These counters are implemented through **Model Specific Registers** (MSR), control registers used by developers for debugging, tracing, monitoring, etc. Since these registers may be subject to changes from one iteration of a microarchitecture to the next, we will need to consult chapters 18 and 19 from [[https://​www.intel.com/​content/​www/​us/​en/​architecture-and-technology/​64-ia-32-architectures-software-developer-vol-3b-part-2-manual.html|Intel 64 and IA-32 Architectures Developer'​s Manual: Vol. 3B]]. A significant portion of the system statistics that can be generated involve hardware counters. As the name implies, these are special registers that count the number of occurrences of specific events in the CPU. These counters are implemented through **Model Specific Registers** (MSR), control registers used by developers for debugging, tracing, monitoring, etc. Since these registers may be subject to changes from one iteration of a microarchitecture to the next, we will need to consult chapters 18 and 19 from [[https://​www.intel.com/​content/​www/​us/​en/​architecture-and-technology/​64-ia-32-architectures-software-developer-vol-3b-part-2-manual.html|Intel 64 and IA-32 Architectures Developer'​s Manual: Vol. 3B]].
Line 12: Line 16:
   - General Purpose Counters   - General Purpose Counters
       * can be configured to monitor a specific event from a list of over 200 (see chapters 19.1 and 19.2)       * can be configured to monitor a specific event from a list of over 200 (see chapters 19.1 and 19.2)
- 
-Download {{:​ep:​labs:​01:​contents:​tasks:​hw_counter.zip|}}. 
  
 Here is an overview of the following five tasks: Here is an overview of the following five tasks:
Line 136: Line 138:
  
 <​solution -hidden> <​solution -hidden>
-**Task E:** 
-<code C> 
-#define rdpmc(ecx, eax, edx)    \ 
-    asm volatile (              \ 
-        "​rdpmc" ​                \ 
-        : "​=a"​(eax), ​           \ 
-          "​=d"​(edx) ​            \ 
-        : "​c"​(ecx)) 
-</​code>​ 
- 
 <code C> <code C>
 /* hardware counter init */ /* hardware counter init */
Line 163: Line 155:
  
 </​solution>​ </​solution>​
 +
  
ep/labs/03/contents/tasks/ex5.1741170348.txt.gz ยท Last modified: 2025/03/05 12:25 by radu.mantu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0