Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(344)

Unified Diff: runtime/bin/thread_win.cc

Issue 2613283002: Fuchsia: Use new call to get thread CPU time (Closed)
Patch Set: Delete dead code Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/thread_macos.cc ('k') | runtime/vm/os_fuchsia.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/thread_win.cc
diff --git a/runtime/bin/thread_win.cc b/runtime/bin/thread_win.cc
index b491a512c65f212908d98fcbcaa6a610157cfd6b..2bb09429bf1d5ef285a938df2d934c051bb4a982 100644
--- a/runtime/bin/thread_win.cc
+++ b/runtime/bin/thread_win.cc
@@ -114,35 +114,6 @@ bool Thread::Compare(ThreadId a, ThreadId b) {
}
-void Thread::GetThreadCpuUsage(ThreadId thread_id, int64_t* cpu_usage) {
- static const int64_t kTimeEpoc = 116444736000000000LL;
- static const int64_t kTimeScaler = 10; // 100 ns to us.
- // Although win32 uses 64-bit integers for representing timestamps,
- // these are packed into a FILETIME structure. The FILETIME
- // structure is just a struct representing a 64-bit integer. The
- // TimeStamp union allows access to both a FILETIME and an integer
- // representation of the timestamp. The Windows timestamp is in
- // 100-nanosecond intervals since January 1, 1601.
- union TimeStamp {
- FILETIME ft_;
- int64_t t_;
- };
- ASSERT(cpu_usage != NULL);
- TimeStamp created;
- TimeStamp exited;
- TimeStamp kernel;
- TimeStamp user;
- HANDLE handle = OpenThread(THREAD_QUERY_INFORMATION, false, thread_id);
- BOOL result =
- GetThreadTimes(handle, &created.ft_, &exited.ft_, &kernel.ft_, &user.ft_);
- CloseHandle(handle);
- if (!result) {
- FATAL1("GetThreadCpuUsage failed %d\n", GetLastError());
- }
- *cpu_usage = (user.t_ - kTimeEpoc) / kTimeScaler;
-}
-
-
void Thread::SetThreadLocal(ThreadLocalKey key, uword value) {
ASSERT(key != kUnsetThreadLocalKey);
BOOL result = TlsSetValue(key, reinterpret_cast<void*>(value));
« no previous file with comments | « runtime/bin/thread_macos.cc ('k') | runtime/vm/os_fuchsia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698