Skip to content

Use macOS clock_gettime in timespec_now if it's available. Reduces CPU usage.#267

Open
ajackson-adi wants to merge 1 commit intowjwwood:mainfrom
ajackson-adi:fix-high-cpu-mac
Open

Use macOS clock_gettime in timespec_now if it's available. Reduces CPU usage.#267
ajackson-adi wants to merge 1 commit intowjwwood:mainfrom
ajackson-adi:fix-high-cpu-mac

Conversation

@ajackson-adi
Copy link
Copy Markdown

We were finding high CPU usage on macOS when connected to very active serial connections. After running the XCode profiler it pointed to this function.

clock_gettime is available in macOS 10.12 and higher. This change is to use that if it's available. If they are targeting a lower macOS minimum version check it at runtime, otherwise do it at compile time.

CPU usage was reduced to a more acceptable level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant