Skip to content

Commit

Permalink
v8_platform.cc: Added AddTraceEventWithTimestamp
Browse files Browse the repository at this point in the history
This commit adds AddTraceEventWithTimestamp to the implementation
gin::V8Platform::TracingControllerImpl.

Bug: 953949
Change-Id: I73aa361feeaf74bcaaf2e6cfd00dce761227f5a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1572583
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#653766}
  • Loading branch information
Sajal Khandelwal authored and Commit Bot committed Apr 24, 2019
1 parent 73d9ec5 commit 56c2931
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,7 @@ Ryan Sleevi <ryan-chromium-dev@sleevi.com>
Ryan Yoakum <ryoakum@skobalt.com>
Ryuan Choi <ryuan.choi@samsung.com>
Saikrishna Arcot <saiarcot895@gmail.com>
Sajal Khandelwal <skhandelwa22@bloomberg.net>
Salvatore Iovene <salvatore.iovene@intel.com>
Sam Larison <qufighter@gmail.com>
Sam McDonald <sam@sammcd.com>
Expand Down
30 changes: 30 additions & 0 deletions gin/v8_platform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,36 @@ class V8Platform::TracingControllerImpl : public v8::TracingController {
memcpy(&result, &handle, sizeof(result));
return result;
}
uint64_t AddTraceEventWithTimestamp(
char phase,
const uint8_t* category_enabled_flag,
const char* name,
const char* scope,
uint64_t id,
uint64_t bind_id,
int32_t num_args,
const char** arg_names,
const uint8_t* arg_types,
const uint64_t* arg_values,
std::unique_ptr<v8::ConvertableToTraceFormat>* arg_convertables,
unsigned int flags,
int64_t timestampMicroseconds) override {
base::trace_event::TraceArguments args(
num_args, arg_names, arg_types,
reinterpret_cast<const unsigned long long*>(arg_values),
arg_convertables);
DCHECK_LE(num_args, 2);
base::TimeTicks timestamp =
base::TimeTicks() +
base::TimeDelta::FromMicroseconds(timestampMicroseconds);
base::trace_event::TraceEventHandle handle =
TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP(
phase, category_enabled_flag, name, scope, id, bind_id,
TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, &args, flags);
uint64_t result;
memcpy(&result, &handle, sizeof(result));
return result;
}
void UpdateTraceEventDuration(const uint8_t* category_enabled_flag,
const char* name,
uint64_t handle) override {
Expand Down

0 comments on commit 56c2931

Please sign in to comment.