Merge "bootanalyze: Use alternative for timestamp alignment" into main
diff --git a/boottime_tools/bootanalyze/Android.bp b/boottime_tools/bootanalyze/Android.bp
new file mode 100644
index 0000000..0259a66
--- /dev/null
+++ b/boottime_tools/bootanalyze/Android.bp
@@ -0,0 +1,37 @@
+//
+// Copyright (C) 2024 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+python_binary_host {
+    name: "bootanalyze",
+    main: "bootanalyze.py",
+    srcs: [
+        "bootanalyze.py",
+    ],
+    libs: [
+        "pyyaml",
+    ],
+}
+
+filegroup {
+    name: "bootanalyze_config",
+    srcs: [
+        "config.yaml",
+    ],
+}
diff --git a/simpleperf/ETMDecoder.cpp b/simpleperf/ETMDecoder.cpp
index d8bf487..9b54663 100644
--- a/simpleperf/ETMDecoder.cpp
+++ b/simpleperf/ETMDecoder.cpp
@@ -973,7 +973,10 @@
 
         callback(instr_range);
 
-        if (b) {
+        // As in "Table D4-10 Meaning of Atom elements in AArch64 A64" of ARMv9 manual,
+        // for branch instructions, b == true means branch taken. But for other instructions
+        // (like ISB), CPU continus to execute following instructions.
+        if (branch_taken) {
           instr.instr_addr = instr.branch_addr;
         } else {
           instr.instr_addr += instr.instr_size;