summaryrefslogtreecommitdiff
path: root/libavutil/cpu.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-05-26 02:18:38 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-05-26 03:19:55 +0200
commit4cf7b87551f2fd2d6f746acda15d33ded192624d (patch)
tree68c81122473ca96ae9ef0114837a26ace5c97f86 /libavutil/cpu.c
parentd480b36db4aaf921d2475d0a0152bf91d79cb2ef (diff)
av_cpu_count: factorize "detected %d logical cores" message
Also print the message just once Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/cpu.c')
-rw-r--r--libavutil/cpu.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavutil/cpu.c b/libavutil/cpu.c
index 73d58565f3..10e15ba668 100644
--- a/libavutil/cpu.c
+++ b/libavutil/cpu.c
@@ -198,6 +198,8 @@ int av_parse_cpu_caps(unsigned *flags, const char *s)
int av_cpu_count(void)
{
+ static volatile int printed;
+
int ret, nb_cpus = 1;
#if HAVE_SCHED_GETAFFINITY && defined(CPU_COUNT)
cpu_set_t cpuset;
@@ -226,6 +228,11 @@ int av_cpu_count(void)
nb_cpus = sysconf(_SC_NPROCESSORS_ONLN);
#endif
+ if (!printed) {
+ av_log(NULL, AV_LOG_DEBUG, "detected %d logical cores\n", nb_cpus);
+ printed = 1;
+ }
+
return nb_cpus;
}