Ticket #52822: patch-gstreamer1-darwin-numcpufix-sysctl.diff
File patch-gstreamer1-darwin-numcpufix-sysctl.diff, 1.0 KB (added by ken-cunningham-webuse, 8 years ago) |
---|
-
plugins/tracers/gstrusage.c
old new 39 39 #include <sys/resource.h> 40 40 #endif 41 41 42 #include <sys/types.h> 43 #include <sys/sysctl.h> 44 42 45 GST_DEBUG_CATEGORY_STATIC (gst_rusage_debug); 43 46 #define GST_CAT_DEFAULT gst_rusage_debug 44 47 … … 274 277 275 278 gobject_class->finalize = gst_rusage_tracer_finalize; 276 279 277 if ((num_cpus = sysconf (_SC_NPROCESSORS_ONLN)) == -1) { 278 GST_WARNING ("failed to get number of cpus online"); 279 if ((num_cpus = sysconf (_SC_NPROCESSORS_CONF)) == -1) { 280 GST_WARNING ("failed to get number of cpus, assuming 1"); 281 num_cpus = 1; 282 } 280 int nm[2]; 281 size_t len = 4; 282 uint32_t count; 283 284 nm[0] = CTL_HW; nm[1] = HW_AVAILCPU; 285 sysctl(nm, 2, &count, &len, NULL, 0); 286 287 if (count < 1) { 288 nm[1] = HW_NCPU; 289 sysctl(nm, 2, &count, &len, NULL, 0); 290 if (count < 1) { count = 1; } 283 291 } 292 num_cpus = (glong)count; 293 284 294 GST_DEBUG ("rusage: num_cpus=%ld", num_cpus); 285 295 286 296 /* announce trace formats */