From 98aefe07b6e28632fff0efce6b71f1f816cfc1dc Mon Sep 17 00:00:00 2001 From: Mythri Alle Date: Mon, 27 Feb 2023 18:50:44 +0000 Subject: Collect timestamps directly from the JITed code JIT code was calling out to C++ code to collect timestamps at method entry / exit when precise profiling is enabled. Calling out to C++ would involve setting up a frame and spilling registers which can be expensive. This CL generates code to collect timestamps and update the per-thread buffer so we can collect timestamps directly from JITed code. This also updates the test to check timestamps are monotonic. Bug: 259258187 Test: art/test.py Change-Id: I07148d4e2605bbb0e75062e0f4642a7f7847bebb --- compiler/utils/x86/assembler_x86.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'compiler/utils/x86/assembler_x86.h') diff --git a/compiler/utils/x86/assembler_x86.h b/compiler/utils/x86/assembler_x86.h index 0f7854dc5c..e6503045fa 100644 --- a/compiler/utils/x86/assembler_x86.h +++ b/compiler/utils/x86/assembler_x86.h @@ -955,6 +955,12 @@ class X86Assembler final : public Assembler { lock()->xaddl(address, reg); } + void rdtsc() { + AssemblerBuffer::EnsureCapacity ensured(&buffer_); + EmitUint8(0x0F); + EmitUint8(0x31); + } + // // Misc. functionality // -- cgit v1.2.3-59-g8ed1b