X-Git-Url: https://git.saurik.com/apple/system_cmds.git/blobdiff_plain/1a7e3f61d38d679bba59130891c2031b5a0092b6..bd6521f0fc816ab056bc71376f9706a69b3b52c1:/kdprof/SleepAction.cpp diff --git a/kdprof/SleepAction.cpp b/kdprof/SleepAction.cpp new file mode 100644 index 0000000..1c00a76 --- /dev/null +++ b/kdprof/SleepAction.cpp @@ -0,0 +1,17 @@ +// +// SleepAction.cpp +// kdprof +// +// Created by James McIlree on 4/17/13. +// Copyright (c) 2013 Apple. All rights reserved. +// + +#include "global.h" + +void SleepAction::execute(Globals& globals) { + uint64_t nanos = _time.value(); + struct timespec ts; + ts.tv_sec = decltype(ts.tv_sec)(nanos / NANOSECONDS_PER_SECOND); + ts.tv_nsec = decltype(ts.tv_sec)(nanos - ts.tv_sec * NANOSECONDS_PER_SECOND); + nanosleep(&ts, NULL); +}