Ignore:
Timestamp:
Dec 6, 2009, 10:21:40 PM (11 years ago)
Author:
Sam Hocevar
Message:

Gather profiling information in caca_refresh_display() and caca_get_event().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/graphics.c

    r3571 r4094  
    148148int caca_refresh_display(caca_display_t *dp)
    149149{
     150#if defined PROF
     151    caca_timer_t proftimer = { 0, 0 };
     152#endif
    150153#if !defined(_DOXYGEN_SKIP_ME)
    151 #define IDLE_USEC 5000
     154#   define IDLE_USEC 5000
    152155#endif
    153156    int ticks = dp->lastticks + _caca_getticks(&dp->timer);
    154157
     158#if defined PROF
     159    _caca_getticks(&proftimer);
     160#endif
    155161    dp->drv.display(dp);
     162#if defined PROF
     163    STAT_IADD(&dp->display_stat, _caca_getticks(&proftimer));
     164#endif
    156165
    157166    /* Invalidate the dirty rectangle */
     
    165174    }
    166175
     176#if defined PROF
     177    _caca_getticks(&proftimer);
     178#endif
    167179    /* Wait until dp->delay + time of last call */
    168180    ticks += _caca_getticks(&dp->timer);
     
    173185        _caca_sleep(IDLE_USEC);
    174186    }
     187#if defined PROF
     188    STAT_IADD(&dp->wait_stat, _caca_getticks(&proftimer));
     189#endif
    175190
    176191    /* Update the render time */
     
    183198        dp->lastticks = 0;
    184199
     200#if defined PROF
     201    _caca_dump_stats();
     202#endif
     203
    185204    return 0;
    186205}
Note: See TracChangeset for help on using the changeset viewer.