>>>>> "Chris" == Chris Friesen <[EMAIL PROTECTED]> writes:
Chris> krishna wrote: >> Hi All, >> >> Can any one tell me how to measure time accurately for a block of C >> code in device drivers. For example, If I want to measure the time >> duration of firmware download. Chris> Most cpus have some way of getting at a counter or decrementer Chris> of various frequencies. Usually it requires low-level hardware Chris> knowledge and often it needs assembly code. As a device driver is inside the linux kernel (unless you're writein a user-mode device driver :-)) you can use the getcycles() macro that's defined for most architectures. It provides a snapshot of the cycle-counter. Caveats: 1. If you're running with power management, the cycle counter ticks at a variable rate. 2. If you're on a multiprocessor, the cycle counters of different processors need not be synchronised. -- Dr Peter Chubb http://www.gelato.unsw.edu.au peterc AT gelato.unsw.edu.au The technical we do immediately, the political takes *forever* - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/