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

Side by Side Diff: content/child/blink_platform_impl.cc

Issue 870053006: Provides a second version of addTraceEvent that accepts a timestamp. This is in preparation for the… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed to use time based on TimeTicks (monotonicallyIncreasingTime) rather than Time (currentTime). Created 5 years, 10 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 | « content/child/blink_platform_impl.h ('k') | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/child/blink_platform_impl.h" 5 #include "content/child/blink_platform_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 static_assert( 596 static_assert(
597 sizeof(blink::Platform::TraceEventHandle) == 597 sizeof(blink::Platform::TraceEventHandle) ==
598 sizeof(base::debug::TraceEventHandle), 598 sizeof(base::debug::TraceEventHandle),
599 "TraceEventHandle types must be same size"); 599 "TraceEventHandle types must be same size");
600 600
601 blink::Platform::TraceEventHandle BlinkPlatformImpl::addTraceEvent( 601 blink::Platform::TraceEventHandle BlinkPlatformImpl::addTraceEvent(
602 char phase, 602 char phase,
603 const unsigned char* category_group_enabled, 603 const unsigned char* category_group_enabled,
604 const char* name, 604 const char* name,
605 unsigned long long id, 605 unsigned long long id,
606 double timestamp,
606 int num_args, 607 int num_args,
607 const char** arg_names, 608 const char** arg_names,
608 const unsigned char* arg_types, 609 const unsigned char* arg_types,
609 const unsigned long long* arg_values, 610 const unsigned long long* arg_values,
610 unsigned char flags) { 611 unsigned char flags) {
611 base::debug::TraceEventHandle handle = TRACE_EVENT_API_ADD_TRACE_EVENT( 612 base::TimeTicks timestamp_tt = base::TimeTicks::FromInternalValue(
612 phase, category_group_enabled, name, id, 613 static_cast<int64>(timestamp * base::Time::kMicrosecondsPerSecond));
613 num_args, arg_names, arg_types, arg_values, NULL, flags); 614 base::debug::TraceEventHandle handle =
615 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP(
616 phase, category_group_enabled, name, id,
617 base::PlatformThread::CurrentId(),
618 timestamp_tt,
619 num_args, arg_names, arg_types, arg_values, NULL, flags);
614 blink::Platform::TraceEventHandle result; 620 blink::Platform::TraceEventHandle result;
615 memcpy(&result, &handle, sizeof(result)); 621 memcpy(&result, &handle, sizeof(result));
616 return result; 622 return result;
617 } 623 }
618 624
619 blink::Platform::TraceEventHandle BlinkPlatformImpl::addTraceEvent( 625 blink::Platform::TraceEventHandle BlinkPlatformImpl::addTraceEvent(
620 char phase, 626 char phase,
621 const unsigned char* category_group_enabled, 627 const unsigned char* category_group_enabled,
622 const char* name, 628 const char* name,
623 unsigned long long id, 629 unsigned long long id,
630 double timestamp,
624 int num_args, 631 int num_args,
625 const char** arg_names, 632 const char** arg_names,
626 const unsigned char* arg_types, 633 const unsigned char* arg_types,
627 const unsigned long long* arg_values, 634 const unsigned long long* arg_values,
628 const blink::WebConvertableToTraceFormat* convertable_values, 635 const blink::WebConvertableToTraceFormat* convertable_values,
629 unsigned char flags) { 636 unsigned char flags) {
630 scoped_refptr<base::debug::ConvertableToTraceFormat> convertable_wrappers[2]; 637 scoped_refptr<base::debug::ConvertableToTraceFormat> convertable_wrappers[2];
631 if (convertable_values) { 638 if (convertable_values) {
632 size_t size = std::min(static_cast<size_t>(num_args), 639 size_t size = std::min(static_cast<size_t>(num_args),
633 arraysize(convertable_wrappers)); 640 arraysize(convertable_wrappers));
634 for (size_t i = 0; i < size; ++i) { 641 for (size_t i = 0; i < size; ++i) {
635 if (arg_types[i] == TRACE_VALUE_TYPE_CONVERTABLE) { 642 if (arg_types[i] == TRACE_VALUE_TYPE_CONVERTABLE) {
636 convertable_wrappers[i] = 643 convertable_wrappers[i] =
637 new ConvertableToTraceFormatWrapper(convertable_values[i]); 644 new ConvertableToTraceFormatWrapper(convertable_values[i]);
638 } 645 }
639 } 646 }
640 } 647 }
648 base::TimeTicks timestamp_tt = base::TimeTicks::FromInternalValue(
649 static_cast<int64>(timestamp * base::Time::kMicrosecondsPerSecond));
641 base::debug::TraceEventHandle handle = 650 base::debug::TraceEventHandle handle =
642 TRACE_EVENT_API_ADD_TRACE_EVENT(phase, 651 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP(phase,
643 category_group_enabled, 652 category_group_enabled,
644 name, 653 name,
645 id, 654 id,
655 base::PlatformThread::CurrentId(),
656 timestamp_tt,
646 num_args, 657 num_args,
647 arg_names, 658 arg_names,
648 arg_types, 659 arg_types,
649 arg_values, 660 arg_values,
650 convertable_wrappers, 661 convertable_wrappers,
651 flags); 662 flags);
652 blink::Platform::TraceEventHandle result; 663 blink::Platform::TraceEventHandle result;
653 memcpy(&result, &handle, sizeof(result)); 664 memcpy(&result, &handle, sizeof(result));
654 return result; 665 return result;
655 } 666 }
656 667
668 blink::Platform::TraceEventHandle BlinkPlatformImpl::addTraceEvent(
669 char phase,
670 const unsigned char* category_group_enabled,
671 const char* name,
672 unsigned long long id,
673 int num_args,
674 const char** arg_names,
675 const unsigned char* arg_types,
676 const unsigned long long* arg_values,
677 unsigned char flags) {
678 return addTraceEvent(phase, category_group_enabled, name, id,
679 monotonicallyIncreasingTime(),
680 num_args, arg_names, arg_types, arg_values, flags);
681 }
682
683 blink::Platform::TraceEventHandle BlinkPlatformImpl::addTraceEvent(
684 char phase,
685 const unsigned char* category_group_enabled,
686 const char* name,
687 unsigned long long id,
688 int num_args,
689 const char** arg_names,
690 const unsigned char* arg_types,
691 const unsigned long long* arg_values,
692 const blink::WebConvertableToTraceFormat* convertable_values,
693 unsigned char flags) {
694 return addTraceEvent(phase, category_group_enabled, name, id,
695 monotonicallyIncreasingTime(),
696 num_args, arg_names, arg_types, arg_values,
697 convertable_values, flags);
698 }
699
657 void BlinkPlatformImpl::updateTraceEventDuration( 700 void BlinkPlatformImpl::updateTraceEventDuration(
658 const unsigned char* category_group_enabled, 701 const unsigned char* category_group_enabled,
659 const char* name, 702 const char* name,
660 TraceEventHandle handle) { 703 TraceEventHandle handle) {
661 base::debug::TraceEventHandle traceEventHandle; 704 base::debug::TraceEventHandle traceEventHandle;
662 memcpy(&traceEventHandle, &handle, sizeof(handle)); 705 memcpy(&traceEventHandle, &handle, sizeof(handle));
663 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( 706 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(
664 category_group_enabled, name, traceEventHandle); 707 category_group_enabled, name, traceEventHandle);
665 } 708 }
666 709
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 } 1280 }
1238 1281
1239 // static 1282 // static
1240 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { 1283 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) {
1241 WebThreadImplForMessageLoop* impl = 1284 WebThreadImplForMessageLoop* impl =
1242 static_cast<WebThreadImplForMessageLoop*>(thread); 1285 static_cast<WebThreadImplForMessageLoop*>(thread);
1243 delete impl; 1286 delete impl;
1244 } 1287 }
1245 1288
1246 } // namespace content 1289 } // namespace content
OLDNEW
« no previous file with comments | « content/child/blink_platform_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698