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

Side by Side Diff: runtime/vm/timeline.cc

Issue 2985253002: [corelib] dart:developer timeline flow events (Closed)
Patch Set: Update changelog Created 3 years, 4 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 | « runtime/vm/timeline.h ('k') | runtime/vm/timeline_android.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 (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #ifndef PRODUCT 6 #ifndef PRODUCT
7 7
8 #include "vm/timeline.h" 8 #include "vm/timeline.h"
9 9
10 #include <errno.h> 10 #include <errno.h>
(...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after
1689 "\"ts\":%" Pd64 ",\"ph\":\"X\",\"dur\":%" Pd64 ",\"args\":%s}", 1689 "\"ts\":%" Pd64 ",\"ph\":\"X\",\"dur\":%" Pd64 ",\"args\":%s}",
1690 name, category, tid, pid, start, duration, args); 1690 name, category, tid, pid, start, duration, args);
1691 } 1691 }
1692 ASSERT(json != NULL); 1692 ASSERT(json != NULL);
1693 1693
1694 event->Duration("", start, end, start_cpu, end_cpu); 1694 event->Duration("", start, end, start_cpu, end_cpu);
1695 // json was allocated in the zone and a copy will be stored in event. 1695 // json was allocated in the zone and a copy will be stored in event.
1696 event->CompleteWithPreSerializedJSON(json); 1696 event->CompleteWithPreSerializedJSON(json);
1697 } 1697 }
1698 1698
1699 void DartCommonTimelineEventHelpers::ReportFlowEvent(Thread* thread,
1700 Zone* zone,
1701 TimelineEvent* event,
1702 int64_t start,
1703 int64_t start_cpu,
1704 const char* category,
1705 const char* name,
1706 int64_t type,
1707 int64_t flow_id,
1708 const char* args) {
1709 const int64_t pid = OS::ProcessId();
1710 OSThread* os_thread = thread->os_thread();
1711 ASSERT(os_thread != NULL);
1712 const int64_t tid = OSThread::ThreadIdToIntPtr(os_thread->trace_id());
1713
1714 TimelineEvent::EventType event_type =
1715 static_cast<TimelineEvent::EventType>(type);
1716 const char* typestr;
1717 const char* bpstr = "";
1718 switch (event_type) {
1719 case TimelineEvent::kFlowBegin:
1720 typestr = "s";
1721 break;
1722 case TimelineEvent::kFlowStep:
1723 typestr = "t";
1724 break;
1725 case TimelineEvent::kFlowEnd:
1726 typestr = "f";
1727 bpstr = ", \"bp\":\"e\"";
1728 break;
1729 default:
1730 UNREACHABLE();
1731 break;
1732 }
1733
1734 char* json = OS::SCreate(
1735 zone,
1736 "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64
1737 ","
1738 "\"ts\":%" Pd64 ",\"ph\":\"%s\", \"id\":%" Pd64 "%s, \"args\":%s}",
1739 name, category, tid, pid, start, typestr, flow_id, bpstr, args);
1740 ASSERT(json != NULL);
1741
1742 // Doesn't really matter what it is since it gets overriden by the
1743 // preserialized json.
1744 event->FlowBegin("", flow_id, start);
1745
1746 // json was allocated in the zone and a copy will be stored in event.
1747 event->CompleteWithPreSerializedJSON(json);
1748 }
1749
1699 void DartCommonTimelineEventHelpers::ReportInstantEvent(Thread* thread, 1750 void DartCommonTimelineEventHelpers::ReportInstantEvent(Thread* thread,
1700 Zone* zone, 1751 Zone* zone,
1701 TimelineEvent* event, 1752 TimelineEvent* event,
1702 int64_t start, 1753 int64_t start,
1703 const char* category, 1754 const char* category,
1704 const char* name, 1755 const char* name,
1705 const char* args) { 1756 const char* args) {
1706 const int64_t pid = OS::ProcessId(); 1757 const int64_t pid = OS::ProcessId();
1707 OSThread* os_thread = thread->os_thread(); 1758 OSThread* os_thread = thread->os_thread();
1708 ASSERT(os_thread != NULL); 1759 ASSERT(os_thread != NULL);
1709 const int64_t tid = OSThread::ThreadIdToIntPtr(os_thread->trace_id()); 1760 const int64_t tid = OSThread::ThreadIdToIntPtr(os_thread->trace_id());
1710 1761
1711 char* json = OS::SCreate(zone, 1762 char* json = OS::SCreate(zone,
1712 "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 1763 "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64
1713 ",\"pid\":%" Pd64 1764 ",\"pid\":%" Pd64
1714 "," 1765 ","
1715 "\"ts\":%" Pd64 ",\"ph\":\"I\",\"args\":%s}", 1766 "\"ts\":%" Pd64 ",\"ph\":\"I\",\"args\":%s}",
1716 name, category, tid, pid, start, args); 1767 name, category, tid, pid, start, args);
1717 1768
1718 event->Instant("", start); 1769 event->Instant("", start);
1719 // json was allocated in the zone and a copy will be stored in event. 1770 // json was allocated in the zone and a copy will be stored in event.
1720 event->CompleteWithPreSerializedJSON(json); 1771 event->CompleteWithPreSerializedJSON(json);
1721 } 1772 }
1722 1773
1723 } // namespace dart 1774 } // namespace dart
1724 1775
1725 #endif // !PRODUCT 1776 #endif // !PRODUCT
OLDNEW
« no previous file with comments | « runtime/vm/timeline.h ('k') | runtime/vm/timeline_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698