Changeset cce6acf in mainline for kernel/generic/src/console/cmd.c


Ignore:
Timestamp:
2006-12-13T12:10:23Z (18 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e9db6f9e
Parents:
7e13972
Message:

thread CPU cycles accounting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/cmd.c

    r7e13972 rcce6acf  
    6868#ifdef CONFIG_TEST
    6969#include <test.h>
    70 #endif
    71 
    72 #ifdef CONFIG_BENCH
    73 #include <arch/cycle.h>
    7470#endif
    7571
     
    866862{
    867863        printf("%s\t\t%s\n", test->name, test->desc);
    868 #ifdef CONFIG_BENCH
    869         uint64_t t0 = get_cycle();
    870 #endif
     864       
     865        /* Update and read thread accounting
     866           for benchmarking */
     867        ipl_t ipl = interrupts_disable();
     868        spinlock_lock(&THREAD->lock);
     869        thread_update_accounting();
     870        uint64_t t0 = THREAD->cycles;
     871        spinlock_unlock(&THREAD->lock);
     872        interrupts_restore(ipl);
     873       
     874        /* Execute the test */
    871875        char * ret = test->entry();
    872 #ifdef CONFIG_BENCH
    873         uint64_t dt = get_cycle() - t0;
     876       
     877        /* Update and read thread accounting */
     878        ipl = interrupts_disable();
     879        spinlock_lock(&THREAD->lock);
     880        thread_update_accounting();
     881        uint64_t dt = THREAD->cycles - t0;
     882        spinlock_unlock(&THREAD->lock);
     883        interrupts_restore(ipl);
     884       
    874885        printf("Time: %llu cycles\n", dt);
    875 #endif
    876886       
    877887        if (ret == NULL) {
Note: See TracChangeset for help on using the changeset viewer.