annotate timer.h @ 1028:5dbb12a37c3d libavutil tip

Move av_set_options_string() from libavfilter to libavutil.
author stefano
date Mon, 27 Sep 2010 22:09:53 +0000
parents 0795a743bda1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
604
3c748945c2ad move timer related code in a new timer.h file
aurel
parents: 603
diff changeset
1 /**
899
0795a743bda1 Remove explicit filename from Doxygen @file commands.
diego
parents: 719
diff changeset
2 * @file
604
3c748945c2ad move timer related code in a new timer.h file
aurel
parents: 603
diff changeset
3 * high precision timer, useful to profile code
3c748945c2ad move timer related code in a new timer.h file
aurel
parents: 603
diff changeset
4 *
108
11be8e0d1344 Add official LGPL license headers to the files that were missing them.
diego
parents: 104
diff changeset
5 * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
11be8e0d1344 Add official LGPL license headers to the files that were missing them.
diego
parents: 104
diff changeset
6 *
116
d76a36742464 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 113
diff changeset
7 * This file is part of FFmpeg.
d76a36742464 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 113
diff changeset
8 *
d76a36742464 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 113
diff changeset
9 * FFmpeg is free software; you can redistribute it and/or
108
11be8e0d1344 Add official LGPL license headers to the files that were missing them.
diego
parents: 104
diff changeset
10 * modify it under the terms of the GNU Lesser General Public
11be8e0d1344 Add official LGPL license headers to the files that were missing them.
diego
parents: 104
diff changeset
11 * License as published by the Free Software Foundation; either
116
d76a36742464 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 113
diff changeset
12 * version 2.1 of the License, or (at your option) any later version.
108
11be8e0d1344 Add official LGPL license headers to the files that were missing them.
diego
parents: 104
diff changeset
13 *
116
d76a36742464 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 113
diff changeset
14 * FFmpeg is distributed in the hope that it will be useful,
108
11be8e0d1344 Add official LGPL license headers to the files that were missing them.
diego
parents: 104
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11be8e0d1344 Add official LGPL license headers to the files that were missing them.
diego
parents: 104
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11be8e0d1344 Add official LGPL license headers to the files that were missing them.
diego
parents: 104
diff changeset
17 * Lesser General Public License for more details.
11be8e0d1344 Add official LGPL license headers to the files that were missing them.
diego
parents: 104
diff changeset
18 *
11be8e0d1344 Add official LGPL license headers to the files that were missing them.
diego
parents: 104
diff changeset
19 * You should have received a copy of the GNU Lesser General Public
116
d76a36742464 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 113
diff changeset
20 * License along with FFmpeg; if not, write to the Free Software
108
11be8e0d1344 Add official LGPL license headers to the files that were missing them.
diego
parents: 104
diff changeset
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
11be8e0d1344 Add official LGPL license headers to the files that were missing them.
diego
parents: 104
diff changeset
22 */
11be8e0d1344 Add official LGPL license headers to the files that were missing them.
diego
parents: 104
diff changeset
23
604
3c748945c2ad move timer related code in a new timer.h file
aurel
parents: 603
diff changeset
24 #ifndef AVUTIL_TIMER_H
3c748945c2ad move timer related code in a new timer.h file
aurel
parents: 603
diff changeset
25 #define AVUTIL_TIMER_H
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
26
604
3c748945c2ad move timer related code in a new timer.h file
aurel
parents: 603
diff changeset
27 #include <stdlib.h>
3c748945c2ad move timer related code in a new timer.h file
aurel
parents: 603
diff changeset
28 #include <stdint.h>
3c748945c2ad move timer related code in a new timer.h file
aurel
parents: 603
diff changeset
29 #include "config.h"
129
ccae53673692 Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents: 127
diff changeset
30
719
faf384df4bd7 ARM: START/STOP_TIMER support for ARMv7
mru
parents: 718
diff changeset
31 #if ARCH_ARM
faf384df4bd7 ARM: START/STOP_TIMER support for ARMv7
mru
parents: 718
diff changeset
32 # include "arm/timer.h"
faf384df4bd7 ARM: START/STOP_TIMER support for ARMv7
mru
parents: 718
diff changeset
33 #elif ARCH_BFIN
718
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents: 642
diff changeset
34 # include "bfin/timer.h"
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents: 642
diff changeset
35 #elif ARCH_PPC
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents: 642
diff changeset
36 # include "ppc/timer.h"
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents: 642
diff changeset
37 #elif ARCH_X86
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents: 642
diff changeset
38 # include "x86/timer.h"
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents: 642
diff changeset
39 #endif
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
40
718
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents: 642
diff changeset
41 #if !defined(AV_READ_TIME) && HAVE_GETHRTIME
fa8c9944568f Split libavutil/timer.h per architecture
mru
parents: 642
diff changeset
42 # define AV_READ_TIME gethrtime
370
de3dc287f939 * Making [START|STOP]_TIMER work on architectures that support gethrtime()
romansh
parents: 342
diff changeset
43 #endif
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
44
370
de3dc287f939 * Making [START|STOP]_TIMER work on architectures that support gethrtime()
romansh
parents: 342
diff changeset
45 #ifdef AV_READ_TIME
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
46 #define START_TIMER \
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
47 uint64_t tend;\
370
de3dc287f939 * Making [START|STOP]_TIMER work on architectures that support gethrtime()
romansh
parents: 342
diff changeset
48 uint64_t tstart= AV_READ_TIME();\
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
49
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
50 #define STOP_TIMER(id) \
370
de3dc287f939 * Making [START|STOP]_TIMER work on architectures that support gethrtime()
romansh
parents: 342
diff changeset
51 tend= AV_READ_TIME();\
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
52 {\
452
4b2cd7e98d58 prettyprinting cosmetics
diego
parents: 443
diff changeset
53 static uint64_t tsum=0;\
4b2cd7e98d58 prettyprinting cosmetics
diego
parents: 443
diff changeset
54 static int tcount=0;\
4b2cd7e98d58 prettyprinting cosmetics
diego
parents: 443
diff changeset
55 static int tskip_count=0;\
604
3c748945c2ad move timer related code in a new timer.h file
aurel
parents: 603
diff changeset
56 if(tcount<2 || tend - tstart < 8*tsum/tcount || tend - tstart < 2000){\
452
4b2cd7e98d58 prettyprinting cosmetics
diego
parents: 443
diff changeset
57 tsum+= tend - tstart;\
4b2cd7e98d58 prettyprinting cosmetics
diego
parents: 443
diff changeset
58 tcount++;\
4b2cd7e98d58 prettyprinting cosmetics
diego
parents: 443
diff changeset
59 }else\
4b2cd7e98d58 prettyprinting cosmetics
diego
parents: 443
diff changeset
60 tskip_count++;\
4b2cd7e98d58 prettyprinting cosmetics
diego
parents: 443
diff changeset
61 if(((tcount+tskip_count)&(tcount+tskip_count-1))==0){\
516
80cd26ba5c7c Make START/STOP_TIMER not require -v 2.
michael
parents: 513
diff changeset
62 av_log(NULL, AV_LOG_ERROR, "%"PRIu64" dezicycles in %s, %d runs, %d skips\n",\
452
4b2cd7e98d58 prettyprinting cosmetics
diego
parents: 443
diff changeset
63 tsum*10/tcount, id, tcount, tskip_count);\
4b2cd7e98d58 prettyprinting cosmetics
diego
parents: 443
diff changeset
64 }\
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
65 }
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
66 #else
12
ce8f9f4390c3 COSMETICS: Remove all trailing whitespace.
diego
parents: 11
diff changeset
67 #define START_TIMER
0
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
68 #define STOP_TIMER(id) {}
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
69 #endif
ee8f44bb7c4d libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff changeset
70
604
3c748945c2ad move timer related code in a new timer.h file
aurel
parents: 603
diff changeset
71 #endif /* AVUTIL_TIMER_H */