Revert "traced: report timezone offset in the trace"
This reverts commit 731310eed1b8396b2c01f57b87978a92d55143cb.
Reason for revert: Breaks chromium windows build and fuchsia test b/305715821
Change-Id: I43bcfec8059805b47d16b5dd2a75dc1ec1540a4e
Bug: 305715821
diff --git a/CHANGELOG b/CHANGELOG
index 1f106ea..bec63e0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,6 @@
Unreleased:
Tracing service and probes:
- * Added reporting of TZ offset under system_info.timezone_off_mins .
+ *
Trace Processor:
*
UI:
diff --git a/include/perfetto/base/time.h b/include/perfetto/base/time.h
index ea15dae..f8161ab 100644
--- a/include/perfetto/base/time.h
+++ b/include/perfetto/base/time.h
@@ -20,7 +20,6 @@
#include <time.h>
#include <chrono>
-#include <optional>
#include <string>
#include "perfetto/base/build_config.h"
@@ -246,8 +245,6 @@
return TimeGm(&tms);
}
-std::optional<int32_t> GetTimezoneOffsetMins();
-
} // namespace base
} // namespace perfetto
diff --git a/protos/perfetto/trace/perfetto_trace.proto b/protos/perfetto/trace/perfetto_trace.proto
index bf28006..16112ab 100644
--- a/protos/perfetto/trace/perfetto_trace.proto
+++ b/protos/perfetto/trace/perfetto_trace.proto
@@ -12452,10 +12452,6 @@
// Kernel page size - sysconf(_SC_PAGESIZE).
optional uint32 page_size = 6;
-
- // The timezone offset from UTC, as per strftime("%z"), in minutes.
- // Introduced in v38 / Android V.
- optional int32 timezone_off_mins = 7;
}
// End of protos/perfetto/trace/system_info.proto
diff --git a/protos/perfetto/trace/system_info.proto b/protos/perfetto/trace/system_info.proto
index 9a75773..f4c0507 100644
--- a/protos/perfetto/trace/system_info.proto
+++ b/protos/perfetto/trace/system_info.proto
@@ -44,8 +44,4 @@
// Kernel page size - sysconf(_SC_PAGESIZE).
optional uint32 page_size = 6;
-
- // The timezone offset from UTC, as per strftime("%z"), in minutes.
- // Introduced in v38 / Android V.
- optional int32 timezone_off_mins = 7;
}
diff --git a/src/base/string_utils_unittest.cc b/src/base/string_utils_unittest.cc
index 0138bf1..f65da9f 100644
--- a/src/base/string_utils_unittest.cc
+++ b/src/base/string_utils_unittest.cc
@@ -96,8 +96,6 @@
TEST(StringUtilsTest, StringToInt32) {
EXPECT_EQ(StringToInt32("0"), std::make_optional<int32_t>(0));
EXPECT_EQ(StringToInt32("1"), std::make_optional<int32_t>(1));
- EXPECT_EQ(StringToInt32("+42"), std::make_optional<int32_t>(42));
- EXPECT_EQ(StringToInt32("+0042"), std::make_optional<int32_t>(42));
EXPECT_EQ(StringToInt32("-42"), std::make_optional<int32_t>(-42));
EXPECT_EQ(StringToInt32("42", 16), std::make_optional<int32_t>(0x42));
EXPECT_EQ(StringToInt32("7ffffffe", 16),
diff --git a/src/base/time.cc b/src/base/time.cc
index 1507916..a02c9d6 100644
--- a/src/base/time.cc
+++ b/src/base/time.cc
@@ -18,7 +18,6 @@
#include "perfetto/base/build_config.h"
#include "perfetto/base/logging.h"
-#include "perfetto/ext/base/string_utils.h"
#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
#include <Windows.h>
@@ -79,17 +78,5 @@
return buf;
}
-std::optional<int32_t> GetTimezoneOffsetMins() {
- std::string tz = GetTimeFmt("%z");
- if (tz.size() != 5 || (tz[0] != '+' && tz[0] != '-'))
- return std::nullopt;
- char sign = '\0';
- int32_t hh = 0;
- int32_t mm = 0;
- if (sscanf(tz.c_str(), "%c%2d%2d", &sign, &hh, &mm) != 3)
- return std::nullopt;
- return (hh * 60 + mm) * (sign == '-' ? -1 : 1);
-}
-
} // namespace base
} // namespace perfetto
diff --git a/src/base/time_unittest.cc b/src/base/time_unittest.cc
index 6536bc8..62c8566 100644
--- a/src/base/time_unittest.cc
+++ b/src/base/time_unittest.cc
@@ -16,7 +16,6 @@
#include "perfetto/base/time.h"
-#include "perfetto/ext/base/utils.h"
#include "test/gtest_and_gmock.h"
namespace perfetto {
@@ -73,27 +72,6 @@
EXPECT_LE(elapsed_cputime.count(), 50 * ns_in_ms);
}
-TEST(TimeTest, GetTimezoneOffsetMins) {
- const char* tz = getenv("TZ");
- std::string tz_save(tz ? tz : "");
- auto reset_tz_on_exit = OnScopeExit([&] {
- if (!tz_save.empty())
- setenv("TZ", tz_save.c_str(), 1);
- });
-
- // Note: the sign is reversed in the semantic of the TZ env var.
- // UTC+2 means "2 hours to reach UTC", not "2 hours ahead of UTC".
-
- setenv("TZ", "UTC+2", true);
- EXPECT_EQ(GetTimezoneOffsetMins(), -2 * 60);
-
- setenv("TZ", "UTC-2", true);
- EXPECT_EQ(GetTimezoneOffsetMins(), 2 * 60);
-
- setenv("TZ", "UTC-07:45", true);
- EXPECT_EQ(GetTimezoneOffsetMins(), 7 * 60 + 45);
-}
-
} // namespace
} // namespace base
} // namespace perfetto
diff --git a/src/trace_processor/importers/proto/system_probes_parser.cc b/src/trace_processor/importers/proto/system_probes_parser.cc
index 0eefa57..da6a2d2 100644
--- a/src/trace_processor/importers/proto/system_probes_parser.cc
+++ b/src/trace_processor/importers/proto/system_probes_parser.cc
@@ -603,12 +603,6 @@
Variadic::String(machine_id));
}
- if (packet.has_timezone_off_mins()) {
- context_->metadata_tracker->SetMetadata(
- metadata::timezone_off_mins,
- Variadic::Integer(packet.timezone_off_mins()));
- }
-
if (packet.has_android_build_fingerprint()) {
context_->metadata_tracker->SetMetadata(
metadata::android_build_fingerprint,
diff --git a/src/trace_processor/storage/metadata.h b/src/trace_processor/storage/metadata.h
index ba2f4c0..88eac06 100644
--- a/src/trace_processor/storage/metadata.h
+++ b/src/trace_processor/storage/metadata.h
@@ -48,7 +48,6 @@
F(system_name, KeyType::kSingle, Variadic::kString), \
F(system_release, KeyType::kSingle, Variadic::kString), \
F(system_version, KeyType::kSingle, Variadic::kString), \
- F(timezone_off_mins, KeyType::kSingle, Variadic::kInt), \
F(trace_config_pbtxt, KeyType::kSingle, Variadic::kString), \
F(trace_size_bytes, KeyType::kSingle, Variadic::kInt), \
F(trace_time_clock_id, KeyType::kSingle, Variadic::kInt), \
diff --git a/src/tracing/core/tracing_service_impl.cc b/src/tracing/core/tracing_service_impl.cc
index 45ce1eb..9040ded 100644
--- a/src/tracing/core/tracing_service_impl.cc
+++ b/src/tracing/core/tracing_service_impl.cc
@@ -3470,11 +3470,6 @@
protozero::HeapBuffered<protos::pbzero::TracePacket> packet;
auto* info = packet->set_system_info();
info->set_tracing_service_version(base::GetVersionString());
-
- std::optional<int32_t> tzoff = base::GetTimezoneOffsetMins();
- if (tzoff.has_value())
- info->set_timezone_off_mins(*tzoff);
-
#if !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN) && \
!PERFETTO_BUILDFLAG(PERFETTO_OS_NACL)
struct utsname uname_info;
diff --git a/test/trace_processor/diff_tests/tables/tests.py b/test/trace_processor/diff_tests/tables/tests.py
index a6ff813..83775a3 100644
--- a/test/trace_processor/diff_tests/tables/tests.py
+++ b/test/trace_processor/diff_tests/tables/tests.py
@@ -266,52 +266,18 @@
def test_thread_state_flattened_aggregated(self):
return DiffTestBlueprint(
- trace=DataPath('android_monitor_contention_trace.atr'),
- query="""
+ trace=DataPath('android_monitor_contention_trace.atr'),
+ query="""
INCLUDE PERFETTO MODULE experimental.thread_state_flattened;
select * from experimental_get_flattened_thread_state_aggregated(11155, NULL);
""",
- out=Path('thread_state_flattened_aggregated_csv.out'))
+ out=Path('thread_state_flattened_aggregated_csv.out'))
def test_thread_state_flattened(self):
return DiffTestBlueprint(
- trace=DataPath('android_monitor_contention_trace.atr'),
- query="""
+ trace=DataPath('android_monitor_contention_trace.atr'),
+ query="""
INCLUDE PERFETTO MODULE experimental.thread_state_flattened;
select * from experimental_get_flattened_thread_state(11155, NULL);
""",
- out=Path('thread_state_flattened_csv.out'))
-
- def test_metadata(self):
- return DiffTestBlueprint(
- trace=TextProto(r"""
- packet {
- system_info {
- tracing_service_version: "Perfetto v38.0-0bb49ab54 (0bb49ab54dbe55ce5b9dfea3a2ada68b87aecb65)"
- timezone_off_mins: 60
- utsname {
- sysname: "Darwin"
- version: "Foobar"
- machine: "x86_64"
- release: "22.6.0"
- }
- }
- trusted_uid: 158158
- trusted_packet_sequence_id: 1
- }
- """),
- query=r"""SELECT name, COALESCE(str_value, int_value) as val
- FROM metadata
- WHERE name IN (
- "system_name", "system_version", "system_machine",
- "system_release", "timezone_off_mins")
- ORDER BY name
- """,
- out=Csv(r"""
- "name","val"
- "system_machine","x86_64"
- "system_name","Darwin"
- "system_release","22.6.0"
- "system_version","Foobar"
- "timezone_off_mins",60
- """))
+ out=Path('thread_state_flattened_csv.out'))