Allow to configure InodeFileDataSource.
Bug: 74584014
Change-Id: I4f3afd96e7e017e2ca2a10aac661460a97d4f90c
diff --git a/Android.bp b/Android.bp
index 6113911..4c6044c 100644
--- a/Android.bp
+++ b/Android.bp
@@ -79,6 +79,7 @@
"src/tracing/core/data_source_descriptor.cc",
"src/tracing/core/ftrace_config.cc",
"src/tracing/core/id_allocator.cc",
+ "src/tracing/core/inode_file_config.cc",
"src/tracing/core/null_trace_writer.cc",
"src/tracing/core/packet_stream_validator.cc",
"src/tracing/core/service_impl.cc",
@@ -173,6 +174,7 @@
"src/tracing/core/data_source_descriptor.cc",
"src/tracing/core/ftrace_config.cc",
"src/tracing/core/id_allocator.cc",
+ "src/tracing/core/inode_file_config.cc",
"src/tracing/core/null_trace_writer.cc",
"src/tracing/core/packet_stream_validator.cc",
"src/tracing/core/service_impl.cc",
@@ -316,6 +318,7 @@
"src/tracing/core/data_source_descriptor.cc",
"src/tracing/core/ftrace_config.cc",
"src/tracing/core/id_allocator.cc",
+ "src/tracing/core/inode_file_config.cc",
"src/tracing/core/null_trace_writer.cc",
"src/tracing/core/packet_stream_validator.cc",
"src/tracing/core/service_impl.cc",
@@ -415,6 +418,7 @@
"protos/perfetto/config/data_source_config.proto",
"protos/perfetto/config/data_source_descriptor.proto",
"protos/perfetto/config/ftrace/ftrace_config.proto",
+ "protos/perfetto/config/inode_file/inode_file_config.proto",
"protos/perfetto/config/test_config.proto",
"protos/perfetto/config/trace_config.proto",
],
@@ -427,6 +431,7 @@
"external/perfetto/protos/perfetto/config/data_source_config.pb.cc",
"external/perfetto/protos/perfetto/config/data_source_descriptor.pb.cc",
"external/perfetto/protos/perfetto/config/ftrace/ftrace_config.pb.cc",
+ "external/perfetto/protos/perfetto/config/inode_file/inode_file_config.pb.cc",
"external/perfetto/protos/perfetto/config/test_config.pb.cc",
"external/perfetto/protos/perfetto/config/trace_config.pb.cc",
],
@@ -440,6 +445,7 @@
"protos/perfetto/config/data_source_config.proto",
"protos/perfetto/config/data_source_descriptor.proto",
"protos/perfetto/config/ftrace/ftrace_config.proto",
+ "protos/perfetto/config/inode_file/inode_file_config.proto",
"protos/perfetto/config/test_config.proto",
"protos/perfetto/config/trace_config.proto",
],
@@ -452,6 +458,7 @@
"external/perfetto/protos/perfetto/config/data_source_config.pb.h",
"external/perfetto/protos/perfetto/config/data_source_descriptor.pb.h",
"external/perfetto/protos/perfetto/config/ftrace/ftrace_config.pb.h",
+ "external/perfetto/protos/perfetto/config/inode_file/inode_file_config.pb.h",
"external/perfetto/protos/perfetto/config/test_config.pb.h",
"external/perfetto/protos/perfetto/config/trace_config.pb.h",
],
@@ -468,6 +475,7 @@
"protos/perfetto/config/data_source_config.proto",
"protos/perfetto/config/data_source_descriptor.proto",
"protos/perfetto/config/ftrace/ftrace_config.proto",
+ "protos/perfetto/config/inode_file/inode_file_config.proto",
"protos/perfetto/config/test_config.proto",
"protos/perfetto/config/trace_config.proto",
],
@@ -481,6 +489,7 @@
"external/perfetto/protos/perfetto/config/data_source_config.pbzero.cc",
"external/perfetto/protos/perfetto/config/data_source_descriptor.pbzero.cc",
"external/perfetto/protos/perfetto/config/ftrace/ftrace_config.pbzero.cc",
+ "external/perfetto/protos/perfetto/config/inode_file/inode_file_config.pbzero.cc",
"external/perfetto/protos/perfetto/config/test_config.pbzero.cc",
"external/perfetto/protos/perfetto/config/trace_config.pbzero.cc",
],
@@ -494,6 +503,7 @@
"protos/perfetto/config/data_source_config.proto",
"protos/perfetto/config/data_source_descriptor.proto",
"protos/perfetto/config/ftrace/ftrace_config.proto",
+ "protos/perfetto/config/inode_file/inode_file_config.proto",
"protos/perfetto/config/test_config.proto",
"protos/perfetto/config/trace_config.proto",
],
@@ -507,6 +517,7 @@
"external/perfetto/protos/perfetto/config/data_source_config.pbzero.h",
"external/perfetto/protos/perfetto/config/data_source_descriptor.pbzero.h",
"external/perfetto/protos/perfetto/config/ftrace/ftrace_config.pbzero.h",
+ "external/perfetto/protos/perfetto/config/inode_file/inode_file_config.pbzero.h",
"external/perfetto/protos/perfetto/config/test_config.pbzero.h",
"external/perfetto/protos/perfetto/config/trace_config.pbzero.h",
],
@@ -3134,6 +3145,7 @@
"src/tracing/core/data_source_descriptor.cc",
"src/tracing/core/ftrace_config.cc",
"src/tracing/core/id_allocator.cc",
+ "src/tracing/core/inode_file_config.cc",
"src/tracing/core/null_trace_writer.cc",
"src/tracing/core/packet_stream_validator.cc",
"src/tracing/core/service_impl.cc",
@@ -3362,6 +3374,7 @@
"src/tracing/core/ftrace_config.cc",
"src/tracing/core/id_allocator.cc",
"src/tracing/core/id_allocator_unittest.cc",
+ "src/tracing/core/inode_file_config.cc",
"src/tracing/core/null_trace_writer.cc",
"src/tracing/core/null_trace_writer_unittest.cc",
"src/tracing/core/packet_stream_validator.cc",
diff --git a/include/perfetto/tracing/core/data_source_config.h b/include/perfetto/tracing/core/data_source_config.h
index c722cbb..f3fd793 100644
--- a/include/perfetto/tracing/core/data_source_config.h
+++ b/include/perfetto/tracing/core/data_source_config.h
@@ -37,6 +37,7 @@
#include "perfetto/tracing/core/chrome_config.h"
#include "perfetto/tracing/core/ftrace_config.h"
+#include "perfetto/tracing/core/inode_file_config.h"
#include "perfetto/tracing/core/test_config.h"
// Forward declarations for protobuf types.
@@ -45,6 +46,7 @@
class DataSourceConfig;
class FtraceConfig;
class ChromeConfig;
+class InodeFileConfig;
class TestConfig;
} // namespace protos
} // namespace perfetto
@@ -79,6 +81,11 @@
const ChromeConfig& chrome_config() const { return chrome_config_; }
ChromeConfig* mutable_chrome_config() { return &chrome_config_; }
+ const InodeFileConfig& inode_file_config() const {
+ return inode_file_config_;
+ }
+ InodeFileConfig* mutable_inode_file_config() { return &inode_file_config_; }
+
const std::string& legacy_config() const { return legacy_config_; }
void set_legacy_config(const std::string& value) { legacy_config_ = value; }
@@ -91,6 +98,7 @@
uint32_t trace_duration_ms_ = {};
FtraceConfig ftrace_config_ = {};
ChromeConfig chrome_config_ = {};
+ InodeFileConfig inode_file_config_ = {};
std::string legacy_config_ = {};
TestConfig for_testing_ = {};
diff --git a/include/perfetto/tracing/core/inode_file_config.h b/include/perfetto/tracing/core/inode_file_config.h
new file mode 100644
index 0000000..65e1198
--- /dev/null
+++ b/include/perfetto/tracing/core/inode_file_config.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+/*******************************************************************************
+ * AUTOGENERATED - DO NOT EDIT
+ *******************************************************************************
+ * This file has been generated from the protobuf message
+ * perfetto/config/inode_file/inode_file_config.proto
+ * by
+ * ../../tools/proto_to_cpp/proto_to_cpp.cc.
+ * If you need to make changes here, change the .proto file and then run
+ * ./tools/gen_tracing_cpp_headers_from_protos.py
+ */
+
+#ifndef INCLUDE_PERFETTO_TRACING_CORE_INODE_FILE_CONFIG_H_
+#define INCLUDE_PERFETTO_TRACING_CORE_INODE_FILE_CONFIG_H_
+
+#include <stdint.h>
+#include <string>
+#include <type_traits>
+#include <vector>
+
+#include "perfetto/base/export.h"
+
+// Forward declarations for protobuf types.
+namespace perfetto {
+namespace protos {
+class InodeFileConfig;
+}
+} // namespace perfetto
+
+namespace perfetto {
+
+class PERFETTO_EXPORT InodeFileConfig {
+ public:
+ InodeFileConfig();
+ ~InodeFileConfig();
+ InodeFileConfig(InodeFileConfig&&) noexcept;
+ InodeFileConfig& operator=(InodeFileConfig&&);
+ InodeFileConfig(const InodeFileConfig&);
+ InodeFileConfig& operator=(const InodeFileConfig&);
+
+ // Conversion methods from/to the corresponding protobuf types.
+ void FromProto(const perfetto::protos::InodeFileConfig&);
+ void ToProto(perfetto::protos::InodeFileConfig*) const;
+
+ uint64_t scan_interval_ms() const { return scan_interval_ms_; }
+ void set_scan_interval_ms(uint64_t value) { scan_interval_ms_ = value; }
+
+ uint64_t scan_delay_ms() const { return scan_delay_ms_; }
+ void set_scan_delay_ms(uint64_t value) { scan_delay_ms_ = value; }
+
+ uint64_t scan_batch_size() const { return scan_batch_size_; }
+ void set_scan_batch_size(uint64_t value) { scan_batch_size_ = value; }
+
+ bool do_not_scan() const { return do_not_scan_; }
+ void set_do_not_scan(bool value) { do_not_scan_ = value; }
+
+ private:
+ uint64_t scan_interval_ms_ = {};
+ uint64_t scan_delay_ms_ = {};
+ uint64_t scan_batch_size_ = {};
+ bool do_not_scan_ = {};
+
+ // Allows to preserve unknown protobuf fields for compatibility
+ // with future versions of .proto files.
+ std::string unknown_fields_;
+};
+
+} // namespace perfetto
+#endif // INCLUDE_PERFETTO_TRACING_CORE_INODE_FILE_CONFIG_H_
diff --git a/include/perfetto/tracing/core/trace_config.h b/include/perfetto/tracing/core/trace_config.h
index 2d5bde6..89da57e 100644
--- a/include/perfetto/tracing/core/trace_config.h
+++ b/include/perfetto/tracing/core/trace_config.h
@@ -46,6 +46,7 @@
class DataSourceConfig;
class FtraceConfig;
class ChromeConfig;
+class InodeFileConfig;
class TestConfig;
class TraceConfig_ProducerConfig;
class TraceConfig_StatsdMetadata;
diff --git a/protos/perfetto/config/BUILD.gn b/protos/perfetto/config/BUILD.gn
index 77dc8613..4fb1011 100644
--- a/protos/perfetto/config/BUILD.gn
+++ b/protos/perfetto/config/BUILD.gn
@@ -25,6 +25,7 @@
"data_source_config.proto",
"data_source_descriptor.proto",
"ftrace/ftrace_config.proto",
+ "inode_file/inode_file_config.proto",
"test_config.proto",
"trace_config.proto",
]
@@ -38,6 +39,7 @@
"data_source_config.proto",
"data_source_descriptor.proto",
"ftrace/ftrace_config.proto",
+ "inode_file/inode_file_config.proto",
"test_config.proto",
"trace_config.proto",
]
diff --git a/protos/perfetto/config/data_source_config.proto b/protos/perfetto/config/data_source_config.proto
index 07824fe..4c4d747 100644
--- a/protos/perfetto/config/data_source_config.proto
+++ b/protos/perfetto/config/data_source_config.proto
@@ -21,6 +21,7 @@
import "perfetto/config/chrome/chrome_config.proto";
import "perfetto/config/ftrace/ftrace_config.proto";
+import "perfetto/config/inode_file/inode_file_config.proto";
import "perfetto/config/test_config.proto";
// When editing this file run ./tools/gen_tracing_cpp_headers_from_protos.py
// to reflect changes in the corresponding C++ headers.
@@ -49,6 +50,7 @@
optional FtraceConfig ftrace_config = 100;
optional ChromeConfig chrome_config = 101;
+ optional InodeFileConfig inode_file_config = 102;
// This is a fallback mechanism to send a free-form text config to the
// producer. In theory this should never be needed. All the code that
diff --git a/protos/perfetto/config/inode_file/inode_file_config.proto b/protos/perfetto/config/inode_file/inode_file_config.proto
new file mode 100644
index 0000000..7a57fd4
--- /dev/null
+++ b/protos/perfetto/config/inode_file/inode_file_config.proto
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+syntax = "proto2";
+option optimize_for = LITE_RUNTIME;
+
+package perfetto.protos;
+
+// When editing this file run ./tools/gen_tracing_cpp_headers_from_protos.py
+// to reflect changes in the corresponding C++ headers.
+
+message InodeFileConfig {
+ // How long to pause between batches.
+ optional uint64 scan_interval_ms = 1;
+
+ // How long to wait before the first scan in order to accumulate inodes.
+ optional uint64 scan_delay_ms = 2;
+
+ // How many inodes to scan in one batch.
+ optional uint64 scan_batch_size = 3;
+
+ // Do not scan for inodes not found in the static map.
+ optional bool do_not_scan = 4;
+}
diff --git a/protos/perfetto/config/perfetto_config.proto b/protos/perfetto/config/perfetto_config.proto
index e8f5d7b..4119fef 100644
--- a/protos/perfetto/config/perfetto_config.proto
+++ b/protos/perfetto/config/perfetto_config.proto
@@ -22,6 +22,27 @@
// End of protos/perfetto/config/chrome/chrome_config.proto
+// Begin of protos/perfetto/config/inode_file/inode_file_config.proto
+
+// When editing this file run ./tools/gen_tracing_cpp_headers_from_protos.py
+// to reflect changes in the corresponding C++ headers.
+
+message InodeFileConfig {
+ // How long to pause between batches.
+ optional uint64 scan_interval_ms = 1;
+
+ // How long to wait before the first scan in order to accumulate inodes.
+ optional uint64 scan_delay_ms = 2;
+
+ // How many inodes to scan in one batch.
+ optional uint64 scan_batch_size = 3;
+
+ // Do not scan for inodes not found in the static map.
+ optional bool do_not_scan = 4;
+}
+
+// End of protos/perfetto/config/inode_file/inode_file_config.proto
+
// Begin of protos/perfetto/config/data_source_config.proto
// When editing this file run ./tools/gen_tracing_cpp_headers_from_protos.py
@@ -51,6 +72,7 @@
optional FtraceConfig ftrace_config = 100;
optional ChromeConfig chrome_config = 101;
+ optional InodeFileConfig inode_file_config = 102;
// This is a fallback mechanism to send a free-form text config to the
// producer. In theory this should never be needed. All the code that
diff --git a/src/traced/probes/filesystem/inode_file_data_source.cc b/src/traced/probes/filesystem/inode_file_data_source.cc
index b75fc02..d6fa6b5 100644
--- a/src/traced/probes/filesystem/inode_file_data_source.cc
+++ b/src/traced/probes/filesystem/inode_file_data_source.cc
@@ -33,8 +33,15 @@
namespace perfetto {
namespace {
-const int kScanIntervalMs = 10000; // 10s
-uint64_t kScanBatchSize = 15000;
+constexpr uint64_t kScanIntervalMs = 10000; // 10s
+constexpr uint64_t kScanDelayMs = 10000; // 10s
+constexpr uint64_t kScanBatchSize = 15000;
+
+uint64_t OrDefault(uint64_t value, uint64_t def) {
+ if (value != 0)
+ return value;
+ return def;
+}
class StaticMapDelegate : public FileScanner::Delegate {
public:
@@ -79,13 +86,15 @@
}
InodeFileDataSource::InodeFileDataSource(
+ DataSourceConfig source_config,
base::TaskRunner* task_runner,
TracingSessionID id,
std::map<BlockDeviceID, std::unordered_map<Inode, InodeMapValue>>*
static_file_map,
LRUInodeCache* cache,
std::unique_ptr<TraceWriter> writer)
- : task_runner_(task_runner),
+ : source_config_(std::move(source_config)),
+ task_runner_(task_runner),
session_id_(id),
static_file_map_(static_file_map),
cache_(cache),
@@ -163,7 +172,10 @@
// paths/type
AddInodesFromStaticMap(block_device_id, &inode_numbers);
AddInodesFromLRUCache(block_device_id, &inode_numbers);
- // TODO(azappone): Make root directory a mount point
+
+ if (source_config_.inode_file_config().do_not_scan())
+ inode_numbers.clear();
+
if (!inode_numbers.empty()) {
// Try to piggy back the current scan.
auto it = missing_inodes_.find(block_device_id);
@@ -174,7 +186,6 @@
inode_numbers.cend());
if (!scan_running_) {
scan_running_ = true;
- PERFETTO_DLOG("Posting to scan filesystem in %d ms", kScanIntervalMs);
auto weak_this = GetWeakPtr();
task_runner_->PostDelayedTask(
[weak_this] {
@@ -184,7 +195,7 @@
}
weak_this.get()->FindMissingInodes();
},
- kScanIntervalMs);
+ GetScanDelayMs());
}
}
}
@@ -266,7 +277,7 @@
}
weak_this->FindMissingInodes();
},
- kScanIntervalMs);
+ GetScanDelayMs());
}
}
@@ -286,12 +297,27 @@
PERFETTO_DCHECK(file_scanner_.get() == nullptr);
auto weak_this = GetWeakPtr();
- file_scanner_ = std::unique_ptr<FileScanner>(
- new FileScanner(std::move(roots), this, kScanIntervalMs, kScanBatchSize));
+ file_scanner_ = std::unique_ptr<FileScanner>(new FileScanner(
+ std::move(roots), this, GetScanIntervalMs(), GetScanBatchSize()));
file_scanner_->Scan(task_runner_);
}
+uint64_t InodeFileDataSource::GetScanIntervalMs() {
+ return OrDefault(source_config_.inode_file_config().scan_interval_ms(),
+ kScanIntervalMs);
+}
+
+uint64_t InodeFileDataSource::GetScanDelayMs() {
+ return OrDefault(source_config_.inode_file_config().scan_delay_ms(),
+ kScanDelayMs);
+}
+
+uint64_t InodeFileDataSource::GetScanBatchSize() {
+ return OrDefault(source_config_.inode_file_config().scan_batch_size(),
+ kScanBatchSize);
+}
+
base::WeakPtr<InodeFileDataSource> InodeFileDataSource::GetWeakPtr() const {
return weak_factory_.GetWeakPtr();
}
diff --git a/src/traced/probes/filesystem/inode_file_data_source.h b/src/traced/probes/filesystem/inode_file_data_source.h
index e7ce1ed..6b7501d 100644
--- a/src/traced/probes/filesystem/inode_file_data_source.h
+++ b/src/traced/probes/filesystem/inode_file_data_source.h
@@ -29,6 +29,7 @@
#include "perfetto/base/weak_ptr.h"
#include "perfetto/traced/data_source_types.h"
#include "perfetto/tracing/core/basic_types.h"
+#include "perfetto/tracing/core/data_source_config.h"
#include "perfetto/tracing/core/trace_writer.h"
#include "src/traced/probes/filesystem/file_scanner.h"
#include "src/traced/probes/filesystem/fs_mount.h"
@@ -61,6 +62,7 @@
class InodeFileDataSource : public FileScanner::Delegate {
public:
InodeFileDataSource(
+ DataSourceConfig,
base::TaskRunner*,
TracingSessionID,
std::map<BlockDeviceID, std::unordered_map<Inode, InodeMapValue>>*
@@ -95,6 +97,11 @@
void AddRootsForBlockDevice(BlockDeviceID block_device_id,
std::vector<std::string>* roots);
+ uint64_t GetScanIntervalMs();
+ uint64_t GetScanDelayMs();
+ uint64_t GetScanBatchSize();
+
+ const DataSourceConfig source_config_;
base::TaskRunner* task_runner_;
const TracingSessionID session_id_;
std::map<BlockDeviceID, std::unordered_map<Inode, InodeMapValue>>*
diff --git a/src/traced/probes/probes_producer.cc b/src/traced/probes/probes_producer.cc
index a18181d..6d5cf78 100644
--- a/src/traced/probes/probes_producer.cc
+++ b/src/traced/probes/probes_producer.cc
@@ -180,16 +180,17 @@
void ProbesProducer::CreateInodeFileDataSourceInstance(
TracingSessionID session_id,
DataSourceInstanceID id,
- const DataSourceConfig& source_config) {
+ DataSourceConfig source_config) {
PERFETTO_LOG("Inode file map start (id=%" PRIu64 ", target_buf=%" PRIu32 ")",
id, source_config.target_buffer());
auto trace_writer = endpoint_->CreateTraceWriter(
static_cast<BufferID>(source_config.target_buffer()));
if (system_inodes_.empty())
CreateStaticDeviceToInodeMap("/system", &system_inodes_);
- auto file_map_source = std::unique_ptr<InodeFileDataSource>(
- new InodeFileDataSource(task_runner_, session_id, &system_inodes_,
- &cache_, std::move(trace_writer)));
+ auto file_map_source =
+ std::unique_ptr<InodeFileDataSource>(new InodeFileDataSource(
+ std::move(source_config), task_runner_, session_id, &system_inodes_,
+ &cache_, std::move(trace_writer)));
file_map_sources_.emplace(id, std::move(file_map_source));
AddWatchdogsTimer(id, source_config);
}
diff --git a/src/traced/probes/probes_producer.h b/src/traced/probes/probes_producer.h
index bd550c7..eb45935 100644
--- a/src/traced/probes/probes_producer.h
+++ b/src/traced/probes/probes_producer.h
@@ -60,7 +60,7 @@
const DataSourceConfig& config);
void CreateInodeFileDataSourceInstance(TracingSessionID session_id,
DataSourceInstanceID id,
- const DataSourceConfig& config);
+ DataSourceConfig config);
void OnMetadata(const FtraceMetadata& metadata);
diff --git a/src/tracing/BUILD.gn b/src/tracing/BUILD.gn
index 80aedb4..fa39c0a 100644
--- a/src/tracing/BUILD.gn
+++ b/src/tracing/BUILD.gn
@@ -37,6 +37,7 @@
"core/ftrace_config.cc",
"core/id_allocator.cc",
"core/id_allocator.h",
+ "core/inode_file_config.cc",
"core/null_trace_writer.cc",
"core/null_trace_writer.h",
"core/packet_stream_validator.cc",
diff --git a/src/tracing/core/data_source_config.cc b/src/tracing/core/data_source_config.cc
index d4f0fc1..fcc497a 100644
--- a/src/tracing/core/data_source_config.cc
+++ b/src/tracing/core/data_source_config.cc
@@ -30,6 +30,7 @@
#include "perfetto/config/chrome/chrome_config.pb.h"
#include "perfetto/config/data_source_config.pb.h"
#include "perfetto/config/ftrace/ftrace_config.pb.h"
+#include "perfetto/config/inode_file/inode_file_config.pb.h"
#include "perfetto/config/test_config.pb.h"
namespace perfetto {
@@ -60,6 +61,8 @@
chrome_config_.FromProto(proto.chrome_config());
+ inode_file_config_.FromProto(proto.inode_file_config());
+
static_assert(sizeof(legacy_config_) == sizeof(proto.legacy_config()),
"size mismatch");
legacy_config_ = static_cast<decltype(legacy_config_)>(proto.legacy_config());
@@ -90,6 +93,8 @@
chrome_config_.ToProto(proto->mutable_chrome_config());
+ inode_file_config_.ToProto(proto->mutable_inode_file_config());
+
static_assert(sizeof(legacy_config_) == sizeof(proto->legacy_config()),
"size mismatch");
proto->set_legacy_config(
diff --git a/src/tracing/core/inode_file_config.cc b/src/tracing/core/inode_file_config.cc
new file mode 100644
index 0000000..0da3b61
--- /dev/null
+++ b/src/tracing/core/inode_file_config.cc
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+/*******************************************************************************
+ * AUTOGENERATED - DO NOT EDIT
+ *******************************************************************************
+ * This file has been generated from the protobuf message
+ * perfetto/config/inode_file/inode_file_config.proto
+ * by
+ * ../../tools/proto_to_cpp/proto_to_cpp.cc.
+ * If you need to make changes here, change the .proto file and then run
+ * ./tools/gen_tracing_cpp_headers_from_protos.py
+ */
+
+#include "perfetto/tracing/core/inode_file_config.h"
+
+#include "perfetto/config/inode_file/inode_file_config.pb.h"
+
+namespace perfetto {
+
+InodeFileConfig::InodeFileConfig() = default;
+InodeFileConfig::~InodeFileConfig() = default;
+InodeFileConfig::InodeFileConfig(const InodeFileConfig&) = default;
+InodeFileConfig& InodeFileConfig::operator=(const InodeFileConfig&) = default;
+InodeFileConfig::InodeFileConfig(InodeFileConfig&&) noexcept = default;
+InodeFileConfig& InodeFileConfig::operator=(InodeFileConfig&&) = default;
+
+void InodeFileConfig::FromProto(
+ const perfetto::protos::InodeFileConfig& proto) {
+ static_assert(sizeof(scan_interval_ms_) == sizeof(proto.scan_interval_ms()),
+ "size mismatch");
+ scan_interval_ms_ =
+ static_cast<decltype(scan_interval_ms_)>(proto.scan_interval_ms());
+
+ static_assert(sizeof(scan_delay_ms_) == sizeof(proto.scan_delay_ms()),
+ "size mismatch");
+ scan_delay_ms_ = static_cast<decltype(scan_delay_ms_)>(proto.scan_delay_ms());
+
+ static_assert(sizeof(scan_batch_size_) == sizeof(proto.scan_batch_size()),
+ "size mismatch");
+ scan_batch_size_ =
+ static_cast<decltype(scan_batch_size_)>(proto.scan_batch_size());
+
+ static_assert(sizeof(do_not_scan_) == sizeof(proto.do_not_scan()),
+ "size mismatch");
+ do_not_scan_ = static_cast<decltype(do_not_scan_)>(proto.do_not_scan());
+ unknown_fields_ = proto.unknown_fields();
+}
+
+void InodeFileConfig::ToProto(perfetto::protos::InodeFileConfig* proto) const {
+ proto->Clear();
+
+ static_assert(sizeof(scan_interval_ms_) == sizeof(proto->scan_interval_ms()),
+ "size mismatch");
+ proto->set_scan_interval_ms(
+ static_cast<decltype(proto->scan_interval_ms())>(scan_interval_ms_));
+
+ static_assert(sizeof(scan_delay_ms_) == sizeof(proto->scan_delay_ms()),
+ "size mismatch");
+ proto->set_scan_delay_ms(
+ static_cast<decltype(proto->scan_delay_ms())>(scan_delay_ms_));
+
+ static_assert(sizeof(scan_batch_size_) == sizeof(proto->scan_batch_size()),
+ "size mismatch");
+ proto->set_scan_batch_size(
+ static_cast<decltype(proto->scan_batch_size())>(scan_batch_size_));
+
+ static_assert(sizeof(do_not_scan_) == sizeof(proto->do_not_scan()),
+ "size mismatch");
+ proto->set_do_not_scan(
+ static_cast<decltype(proto->do_not_scan())>(do_not_scan_));
+ *(proto->mutable_unknown_fields()) = unknown_fields_;
+}
+
+} // namespace perfetto
diff --git a/tools/gen_merged_trace_config b/tools/gen_merged_trace_config
index 9a7abba..719c734 100755
--- a/tools/gen_merged_trace_config
+++ b/tools/gen_merged_trace_config
@@ -20,6 +20,7 @@
PROTOS = (
'protos/perfetto/config/chrome/chrome_config.proto',
+ 'protos/perfetto/config/inode_file/inode_file_config.proto',
'protos/perfetto/config/data_source_config.proto',
'protos/perfetto/config/ftrace/ftrace_config.proto',
'protos/perfetto/config/test_config.proto',
diff --git a/tools/gen_tracing_cpp_headers_from_protos.py b/tools/gen_tracing_cpp_headers_from_protos.py
index 350c5ad..c10bac0 100755
--- a/tools/gen_tracing_cpp_headers_from_protos.py
+++ b/tools/gen_tracing_cpp_headers_from_protos.py
@@ -20,6 +20,7 @@
PROTOS = (
'perfetto/config/chrome/chrome_config.proto',
'perfetto/config/data_source_config.proto',
+ 'perfetto/config/inode_file/inode_file_config.proto',
'perfetto/config/data_source_descriptor.proto',
'perfetto/config/ftrace/ftrace_config.proto',
'perfetto/config/trace_config.proto',