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

Side by Side Diff: src/platform/time.cc

Issue 23681006: Merged r16456 into trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/version.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 static struct mach_timebase_info info; 502 static struct mach_timebase_info info;
503 if (info.denom == 0) { 503 if (info.denom == 0) {
504 kern_return_t result = mach_timebase_info(&info); 504 kern_return_t result = mach_timebase_info(&info);
505 ASSERT_EQ(KERN_SUCCESS, result); 505 ASSERT_EQ(KERN_SUCCESS, result);
506 USE(result); 506 USE(result);
507 } 507 }
508 ticks = (mach_absolute_time() / Time::kNanosecondsPerMicrosecond * 508 ticks = (mach_absolute_time() / Time::kNanosecondsPerMicrosecond *
509 info.numer / info.denom); 509 info.numer / info.denom);
510 #elif V8_OS_SOLARIS 510 #elif V8_OS_SOLARIS
511 ticks = (gethrtime() / Time::kNanosecondsPerMicrosecond); 511 ticks = (gethrtime() / Time::kNanosecondsPerMicrosecond);
512 #elif V8_LIBRT_NOT_AVAILABLE
513 // TODO(bmeurer): This is a temporary hack to support cross-compiling
514 // Chrome for Android in AOSP. Remove this once AOSP is fixed, also
515 // cleanup the tools/gyp/v8.gyp file.
516 struct timeval tv;
517 int result = gettimeofday(&tv, NULL);
518 ASSERT_EQ(0, result);
519 USE(result);
520 ticks = (tv.tv_sec * Time::kMicrosecondsPerSecond + tv.tv_usec);
512 #elif V8_OS_POSIX 521 #elif V8_OS_POSIX
513 struct timespec ts; 522 struct timespec ts;
514 int result = clock_gettime(CLOCK_MONOTONIC, &ts); 523 int result = clock_gettime(CLOCK_MONOTONIC, &ts);
515 ASSERT_EQ(0, result); 524 ASSERT_EQ(0, result);
516 USE(result); 525 USE(result);
517 ticks = (ts.tv_sec * Time::kMicrosecondsPerSecond + 526 ticks = (ts.tv_sec * Time::kMicrosecondsPerSecond +
518 ts.tv_nsec / Time::kNanosecondsPerMicrosecond); 527 ts.tv_nsec / Time::kNanosecondsPerMicrosecond);
519 #endif // V8_OS_MACOSX 528 #endif // V8_OS_MACOSX
520 // Make sure we never return 0 here. 529 // Make sure we never return 0 here.
521 return TimeTicks(ticks + 1); 530 return TimeTicks(ticks + 1);
522 } 531 }
523 532
524 #endif // V8_OS_WIN 533 #endif // V8_OS_WIN
525 534
526 } } // namespace v8::internal 535 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698