source: libcaca/trunk/caca/caca_prof.h @ 4094

Last change on this file since 4094 was 4094, checked in by Sam Hocevar, 11 years ago

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

  • Property svn:keywords set to Id
File size: 1.1 KB
Line 
1/*
2 *  libcaca       Colour ASCII-Art library
3 *  Copyright (c) 2009 Sam Hocevar <sam@hocevar.net>
4 *                All Rights Reserved
5 *
6 *  $Id: caca_prof.h 4094 2009-12-06 21:21:40Z sam $
7 *
8 *  This library is free software; you can redistribute it and/or
9 *  modify it under the terms of the Do What The Fuck You Want To
10 *  Public License, Version 2, as published by Sam Hocevar. See
11 *  http://sam.zoy.org/wtfpl/COPYING for more details.
12 */
13
14/*
15 *  This file contains profiling functions.
16 */
17
18#ifndef __CACA_PROF_H__
19#define __CACA_PROF_H__
20
21#if defined PROF && !defined __KERNEL__
22#   define PROFILING_VARS
23
24#   define STAT_IADD(s, n) \
25      do \
26      { \
27        struct caca_stat *ss = s; \
28        int ii, nn = n; \
29        for (ii = STAT_VALUES - 1; ii > 0; ii--) \
30            ss->itable[ii] = ss->itable[ii - 1]; \
31        ss->itable[0] = nn; \
32        ss->imean = ((int64_t)ss->imean * 15 + nn) / 16; \
33      } \
34      while(0)
35
36#   define START_PROF(obj, fn)
37#   define STOP_PROF(obj, fn)
38
39#else
40#   define PROFILING_VARS
41#   define STAT_IADD(s) do { } while(0)
42#   define START_PROF(obj, fn) do { } while(0)
43#   define STOP_PROF(obj, fn) do { } while(0)
44#endif
45
46#endif /* __CACA_PROF_H__ */
47
Note: See TracBrowser for help on using the repository browser.