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

Last change on this file since 4333 was 4333, checked in by Sam Hocevar, 10 years ago

Large source code cleanup, getting rid of spaces, tabs, and svn keywords.

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