Commit 4592f5e8 authored by Wez Furlong's avatar Wez Furlong Committed by Facebook Github Bot 2

folly: fix initialization for CLOCK_PROCESS_CPUTIME_ID emulation on macOS

Summary:
this fixes TimeTest on macOS.

The problem was that `task_info_count` is an in/out parameter and it wasn't correctly initialized due to a typo.  The lack of initialization meant that the `task_info()` call would fail at runtime.

Reviewed By: yfeldblum

Differential Revision: D3576262

fbshipit-source-id: 8388fa3c5020309d64a0fa7e01fd6cea80200219
parent 92fd1080
...@@ -50,8 +50,7 @@ static std::chrono::nanoseconds time_value_to_ns(time_value_t t) { ...@@ -50,8 +50,7 @@ static std::chrono::nanoseconds time_value_to_ns(time_value_t t) {
static int clock_process_cputime(struct timespec* ts) { static int clock_process_cputime(struct timespec* ts) {
// Get CPU usage for live threads. // Get CPU usage for live threads.
task_thread_times_info thread_times_info; task_thread_times_info thread_times_info;
mach_msg_type_number_t thread_times_info_count; mach_msg_type_number_t thread_times_info_count = TASK_THREAD_TIMES_INFO_COUNT;
TASK_THREAD_TIMES_INFO_COUNT;
kern_return_t kern_result = task_info( kern_return_t kern_result = task_info(
mach_task_self(), mach_task_self(),
TASK_THREAD_TIMES_INFO, TASK_THREAD_TIMES_INFO,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment