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

Side by Side Diff: base/debug/trace_event_impl.cc

Issue 9474023: Sync trace time on Chrome OS (just like Android) (Closed) Base URL: http://git.chromium.org/git/chromium/src@master
Patch Set: Created 8 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/debug/trace_event_impl.h" 5 #include "base/debug/trace_event_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 const std::string& extra) 676 const std::string& extra)
677 { 677 {
678 #if defined(OS_WIN) 678 #if defined(OS_WIN)
679 TraceEventETWProvider::Trace(name, phase, id, extra); 679 TraceEventETWProvider::Trace(name, phase, id, extra);
680 #endif 680 #endif
681 INTERNAL_TRACE_EVENT_ADD(phase, "ETW Trace Event", name, 681 INTERNAL_TRACE_EVENT_ADD(phase, "ETW Trace Event", name,
682 TRACE_EVENT_FLAG_COPY, "id", id, "extra", extra); 682 TRACE_EVENT_FLAG_COPY, "id", id, "extra", extra);
683 } 683 }
684 684
685 void TraceLog::AddClockSyncMetadataEvents() { 685 void TraceLog::AddClockSyncMetadataEvents() {
686 #if defined(OS_ANDROID) 686 #if defined(OS_ANDROID) || defined(OS_CHROMEOS)
687 // Since Android does not support sched_setaffinity, we cannot establish clock 687 // Since Android does not support sched_setaffinity, we cannot establish clock
nduca 2012/02/27 22:47:36 You probably want to adjust the comments here, the
jar (doing other things) 2012/02/27 22:54:10 +1 On 2012/02/27 22:47:36, nduca wrote:
688 // sync unless the scheduler clock is set to global. If the trace_clock file 688 // sync unless the scheduler clock is set to global. If the trace_clock file
689 // can't be read, we will assume the kernel doesn't support tracing and do 689 // can't be read, we will assume the kernel doesn't support tracing and do
690 // nothing. 690 // nothing.
691 std::string clock_mode; 691 std::string clock_mode;
692 if (!file_util::ReadFileToString( 692 if (!file_util::ReadFileToString(
693 FilePath("/sys/kernel/debug/tracing/trace_clock"), 693 FilePath("/sys/kernel/debug/tracing/trace_clock"),
694 &clock_mode)) 694 &clock_mode))
695 return; 695 return;
696 696
697 if (clock_mode != "local [global]\n") { 697 if (clock_mode != "local [global]\n") {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 // Create a FNV hash from the process ID for XORing. 756 // Create a FNV hash from the process ID for XORing.
757 // See http://isthe.com/chongo/tech/comp/fnv/ for algorithm details. 757 // See http://isthe.com/chongo/tech/comp/fnv/ for algorithm details.
758 unsigned long long offset_basis = 14695981039346656037ull; 758 unsigned long long offset_basis = 14695981039346656037ull;
759 unsigned long long fnv_prime = 1099511628211ull; 759 unsigned long long fnv_prime = 1099511628211ull;
760 unsigned long long pid = static_cast<unsigned long long>(process_id_); 760 unsigned long long pid = static_cast<unsigned long long>(process_id_);
761 process_id_hash_ = (offset_basis ^ pid) * fnv_prime; 761 process_id_hash_ = (offset_basis ^ pid) * fnv_prime;
762 } 762 }
763 763
764 } // namespace debug 764 } // namespace debug
765 } // namespace base 765 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698