| Index: runtime/lib/timeline.cc
|
| diff --git a/runtime/lib/timeline.cc b/runtime/lib/timeline.cc
|
| index 300d6e302d9ec9aa4a13beb2fe56bb32b36a07e8..18b89e925ad17acc014425f9d32390a7f8575568 100644
|
| --- a/runtime/lib/timeline.cc
|
| +++ b/runtime/lib/timeline.cc
|
| @@ -85,32 +85,26 @@ DEFINE_NATIVE_ENTRY(Timeline_reportTaskEvent, 6) {
|
| // Convert phase to a C string and perform a sanity check.
|
| const char* phase_string = phase.ToCString();
|
| ASSERT(phase_string != NULL);
|
| - ASSERT((phase_string[0] == 'n') ||
|
| - (phase_string[0] == 'b') ||
|
| + ASSERT((phase_string[0] == 'n') || (phase_string[0] == 'b') ||
|
| (phase_string[0] == 'e'));
|
| ASSERT(phase_string[1] == '\0');
|
| - char* json = OS::SCreate(zone,
|
| - "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64 ","
|
| - "\"ts\":%" Pd64 ",\"ph\":\"%s\",\"id\":%" Pd64 ", \"args\":%s}",
|
| - name.ToCString(),
|
| - category.ToCString(),
|
| - tid,
|
| - pid,
|
| - start.AsInt64Value(),
|
| - phase_string,
|
| - id.AsInt64Value(),
|
| - args.ToCString());
|
| + char* json = OS::SCreate(
|
| + zone, "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64
|
| + ","
|
| + "\"ts\":%" Pd64 ",\"ph\":\"%s\",\"id\":%" Pd64 ", \"args\":%s}",
|
| + name.ToCString(), category.ToCString(), tid, pid, start.AsInt64Value(),
|
| + phase_string, id.AsInt64Value(), args.ToCString());
|
|
|
| switch (phase_string[0]) {
|
| case 'n':
|
| event->AsyncInstant("", id.AsInt64Value(), start.AsInt64Value());
|
| - break;
|
| + break;
|
| case 'b':
|
| event->AsyncBegin("", id.AsInt64Value(), start.AsInt64Value());
|
| - break;
|
| + break;
|
| case 'e':
|
| event->AsyncEnd("", id.AsInt64Value(), start.AsInt64Value());
|
| - break;
|
| + break;
|
| default:
|
| UNREACHABLE();
|
| }
|
| @@ -156,36 +150,25 @@ DEFINE_NATIVE_ENTRY(Timeline_reportCompleteEvent, 5) {
|
| char* json = NULL;
|
|
|
| if ((start_cpu.AsInt64Value() != -1) && (end_cpu != -1)) {
|
| - json = OS::SCreate(zone,
|
| - "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64 ","
|
| - "\"ts\":%" Pd64 ",\"ph\":\"X\",\"dur\":%" Pd64 ","
|
| - "\"tdur\":%" Pd64 ",\"args\":%s}",
|
| - name.ToCString(),
|
| - category.ToCString(),
|
| - tid,
|
| - pid,
|
| - start.AsInt64Value(),
|
| - duration,
|
| - duration_cpu,
|
| - args.ToCString());
|
| + json = OS::SCreate(
|
| + zone, "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64
|
| + ","
|
| + "\"ts\":%" Pd64 ",\"ph\":\"X\",\"dur\":%" Pd64
|
| + ","
|
| + "\"tdur\":%" Pd64 ",\"args\":%s}",
|
| + name.ToCString(), category.ToCString(), tid, pid, start.AsInt64Value(),
|
| + duration, duration_cpu, args.ToCString());
|
| } else {
|
| - json = OS::SCreate(zone,
|
| - "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64 ","
|
| - "\"ts\":%" Pd64 ",\"ph\":\"X\",\"dur\":%" Pd64 ",\"args\":%s}",
|
| - name.ToCString(),
|
| - category.ToCString(),
|
| - tid,
|
| - pid,
|
| - start.AsInt64Value(),
|
| - duration,
|
| - args.ToCString());
|
| + json = OS::SCreate(
|
| + zone, "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64
|
| + ","
|
| + "\"ts\":%" Pd64 ",\"ph\":\"X\",\"dur\":%" Pd64 ",\"args\":%s}",
|
| + name.ToCString(), category.ToCString(), tid, pid, start.AsInt64Value(),
|
| + duration, args.ToCString());
|
| }
|
| ASSERT(json != NULL);
|
|
|
| - event->Duration("",
|
| - start.AsInt64Value(),
|
| - end,
|
| - start_cpu.AsInt64Value(),
|
| + event->Duration("", start.AsInt64Value(), end, start_cpu.AsInt64Value(),
|
| end_cpu);
|
| // json was allocated in the zone and a copy will be stored in event.
|
| event->CompleteWithPreSerializedJSON(json);
|
| @@ -220,14 +203,11 @@ DEFINE_NATIVE_ENTRY(Timeline_reportInstantEvent, 4) {
|
| ASSERT(os_thread != NULL);
|
| int64_t tid = OSThread::ThreadIdToIntPtr(os_thread->trace_id());
|
|
|
| - char* json = OS::SCreate(zone,
|
| - "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64 ","
|
| - "\"ts\":%" Pd64 ",\"ph\":\"I\",\"args\":%s}",
|
| - name.ToCString(),
|
| - category.ToCString(),
|
| - tid,
|
| - pid,
|
| - start.AsInt64Value(),
|
| + char* json = OS::SCreate(
|
| + zone, "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64
|
| + ","
|
| + "\"ts\":%" Pd64 ",\"ph\":\"I\",\"args\":%s}",
|
| + name.ToCString(), category.ToCString(), tid, pid, start.AsInt64Value(),
|
| args.ToCString());
|
|
|
| event->Instant("", start.AsInt64Value());
|
|
|