01 to 10 seconds then it is essential to perform

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: on policy. It performs a computation using array values and stores the result to a global integer (the declaration volatile indicates that any update to this variable must be performed), so that a clever optimizing compiler will not optimize away this part of the code. With this procedure, we can get a measurement of P under conditions where its instructions are cached but its data is not by the following procedure: 1 2 3 4 5 double time_P_cold() { P(); /* Warm up data caches */ clear_cache(); /* Clear data caches */ start_counter(); 9.4. MEASURING PROGRAM EXECUTION TIME WITH CYCLE COUNTERS 6 7 8 467 P(); return get_counter(); } Of course, even this method has deficiencies. On a machine with a unified L2 cache, procedure clear cache will cause all instructions from P to be evicted. Fortunately, the instructions in the L1 instruction cache will remain. Procedure clear cache also evicts much of the runtime stack from the cache, leading to an overestimate of the time required by P under more realistic conditions. As this discussion shows, the effects of caching pose particular...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online