Skip to content

Commit d1380d9

Browse files
authored
[CoreCLR] Enable dumping FastTiming data with CoreCLR (#9961)
Context: a7b5768 Context: https://github.com/grendello/XAPerfTestRunner It seems that as part of refactoring and splitting the big CoreCLR host PR into pieces, the dumping of timing data got disabled for CoreCLR. Reenable this feature so that we can measure startup performance of CoreCLR with grendello/XAPerfTestRunner.
1 parent 349969f commit d1380d9

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/native/clr/host/host-jni.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <host/host.hh>
22
#include <host/host-jni.hh>
33
#include <shared/log_types.hh>
4+
#include <runtime-base/timing-internal.hh>
45

56
using namespace xamarin::android;
67

@@ -15,11 +16,9 @@ JNI_OnLoad (JavaVM *vm, void *reserved)
1516
JNIEXPORT void
1617
JNICALL Java_mono_android_Runtime_dumpTimingData ([[maybe_unused]] JNIEnv *env, [[maybe_unused]] jclass klass)
1718
{
18-
// if (internal_timing == nullptr) {
19-
// return;
20-
// }
21-
22-
// internal_timing.dump ();
19+
if (FastTiming::enabled ()) [[unlikely]] {
20+
internal_timing.dump ();
21+
}
2322
}
2423

2524
JNIEXPORT void

src/native/clr/host/typemap.cc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ auto TypeMapper::typemap_managed_to_java (const char *typeName, const uint8_t *m
212212
{
213213
size_t total_time_index;
214214
if (FastTiming::enabled ()) [[unlikely]] {
215-
//timing = new Timing ();
216215
total_time_index = internal_timing.start_event (TimingEventKind::ManagedToJava);
217216
}
218217

@@ -257,6 +256,11 @@ auto TypeMapper::find_java_to_managed_entry (hash_t name_hash) noexcept -> const
257256
[[gnu::flatten]]
258257
auto TypeMapper::typemap_java_to_managed (const char *java_type_name, char const** assembly_name, uint32_t *managed_type_token_id) noexcept -> bool
259258
{
259+
size_t total_time_index;
260+
if (FastTiming::enabled ()) [[unlikely]] {
261+
total_time_index = internal_timing.start_event (TimingEventKind::JavaToManaged);
262+
}
263+
260264
if (java_type_name == nullptr || assembly_name == nullptr || managed_type_token_id == nullptr) [[unlikely]] {
261265
if (java_type_name == nullptr) {
262266
log_warn (
@@ -314,6 +318,10 @@ auto TypeMapper::typemap_java_to_managed (const char *java_type_name, char const
314318
optional_string (*assembly_name)
315319
);
316320

321+
if (FastTiming::enabled ()) [[unlikely]] {
322+
internal_timing.end_event (total_time_index);
323+
}
324+
317325
return true;
318326
}
319327
#endif // ndef DEBUG

0 commit comments

Comments
 (0)