OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/android/early_trace_event_binding.h" | 5 #include "base/android/early_trace_event_binding.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 const JavaParamRef<jstring>& jname, | 25 const JavaParamRef<jstring>& jname, |
26 jlong begin_time_ms, | 26 jlong begin_time_ms, |
27 jlong end_time_ms, | 27 jlong end_time_ms, |
28 jint thread_id) { | 28 jint thread_id) { |
29 std::string name = ConvertJavaStringToUTF8(env, jname); | 29 std::string name = ConvertJavaStringToUTF8(env, jname); |
30 int64_t begin_us = begin_time_ms * 1000; | 30 int64_t begin_us = begin_time_ms * 1000; |
31 int64_t end_us = end_time_ms * 1000; | 31 int64_t end_us = end_time_ms * 1000; |
32 | 32 |
33 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( | 33 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( |
34 TRACE_EVENT_PHASE_BEGIN, kEarlyJavaCategory, name.c_str(), | 34 TRACE_EVENT_PHASE_BEGIN, kEarlyJavaCategory, name.c_str(), |
35 trace_event_internal::kNoId, thread_id, begin_us, TRACE_EVENT_FLAG_COPY); | 35 trace_event_internal::kNoId, thread_id, |
| 36 TimeTicks::FromInternalValue(begin_us), TRACE_EVENT_FLAG_COPY); |
36 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( | 37 INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( |
37 TRACE_EVENT_PHASE_END, kEarlyJavaCategory, name.c_str(), | 38 TRACE_EVENT_PHASE_END, kEarlyJavaCategory, name.c_str(), |
38 trace_event_internal::kNoId, thread_id, end_us, TRACE_EVENT_FLAG_COPY); | 39 trace_event_internal::kNoId, thread_id, |
| 40 TimeTicks::FromInternalValue(end_us), TRACE_EVENT_FLAG_COPY); |
39 } | 41 } |
40 | 42 |
41 bool RegisterEarlyTraceEvent(JNIEnv* env) { | 43 bool RegisterEarlyTraceEvent(JNIEnv* env) { |
42 return RegisterNativesImpl(env); | 44 return RegisterNativesImpl(env); |
43 } | 45 } |
44 | 46 |
45 } // namespace android | 47 } // namespace android |
46 } // namespace base | 48 } // namespace base |
OLD | NEW |