Home | History | Annotate | Download | only in core
      1 /*
      2  * Copyright (C) 2017 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 /*******************************************************************************
     18  * AUTOGENERATED - DO NOT EDIT
     19  *******************************************************************************
     20  * This file has been generated from the protobuf message
     21  * perfetto/config/trace_config.proto
     22  * by
     23  * ../../tools/proto_to_cpp/proto_to_cpp.cc.
     24  * If you need to make changes here, change the .proto file and then run
     25  * ./tools/gen_tracing_cpp_headers_from_protos.py
     26  */
     27 
     28 #ifndef INCLUDE_PERFETTO_TRACING_CORE_TRACE_CONFIG_H_
     29 #define INCLUDE_PERFETTO_TRACING_CORE_TRACE_CONFIG_H_
     30 
     31 #include <stdint.h>
     32 #include <string>
     33 #include <type_traits>
     34 #include <vector>
     35 
     36 #include "perfetto/base/export.h"
     37 
     38 #include "perfetto/tracing/core/data_source_config.h"
     39 
     40 // Forward declarations for protobuf types.
     41 namespace perfetto {
     42 namespace protos {
     43 class TraceConfig;
     44 class TraceConfig_BufferConfig;
     45 class TraceConfig_DataSource;
     46 class DataSourceConfig;
     47 class FtraceConfig;
     48 class ChromeConfig;
     49 class InodeFileConfig;
     50 class InodeFileConfig_MountPointMappingEntry;
     51 class ProcessStatsConfig;
     52 class TestConfig;
     53 class TraceConfig_ProducerConfig;
     54 class TraceConfig_StatsdMetadata;
     55 class TraceConfig_GuardrailOverrides;
     56 }  // namespace protos
     57 }  // namespace perfetto
     58 
     59 namespace perfetto {
     60 
     61 class PERFETTO_EXPORT TraceConfig {
     62  public:
     63   class PERFETTO_EXPORT BufferConfig {
     64    public:
     65     enum FillPolicy {
     66       UNSPECIFIED = 0,
     67       RING_BUFFER = 1,
     68     };
     69     BufferConfig();
     70     ~BufferConfig();
     71     BufferConfig(BufferConfig&&) noexcept;
     72     BufferConfig& operator=(BufferConfig&&);
     73     BufferConfig(const BufferConfig&);
     74     BufferConfig& operator=(const BufferConfig&);
     75 
     76     // Conversion methods from/to the corresponding protobuf types.
     77     void FromProto(const perfetto::protos::TraceConfig_BufferConfig&);
     78     void ToProto(perfetto::protos::TraceConfig_BufferConfig*) const;
     79 
     80     uint32_t size_kb() const { return size_kb_; }
     81     void set_size_kb(uint32_t value) { size_kb_ = value; }
     82 
     83     FillPolicy fill_policy() const { return fill_policy_; }
     84     void set_fill_policy(FillPolicy value) { fill_policy_ = value; }
     85 
     86    private:
     87     uint32_t size_kb_ = {};
     88     FillPolicy fill_policy_ = {};
     89 
     90     // Allows to preserve unknown protobuf fields for compatibility
     91     // with future versions of .proto files.
     92     std::string unknown_fields_;
     93   };
     94 
     95   class PERFETTO_EXPORT DataSource {
     96    public:
     97     DataSource();
     98     ~DataSource();
     99     DataSource(DataSource&&) noexcept;
    100     DataSource& operator=(DataSource&&);
    101     DataSource(const DataSource&);
    102     DataSource& operator=(const DataSource&);
    103 
    104     // Conversion methods from/to the corresponding protobuf types.
    105     void FromProto(const perfetto::protos::TraceConfig_DataSource&);
    106     void ToProto(perfetto::protos::TraceConfig_DataSource*) const;
    107 
    108     const DataSourceConfig& config() const { return config_; }
    109     DataSourceConfig* mutable_config() { return &config_; }
    110 
    111     int producer_name_filter_size() const {
    112       return static_cast<int>(producer_name_filter_.size());
    113     }
    114     const std::vector<std::string>& producer_name_filter() const {
    115       return producer_name_filter_;
    116     }
    117     std::string* add_producer_name_filter() {
    118       producer_name_filter_.emplace_back();
    119       return &producer_name_filter_.back();
    120     }
    121 
    122    private:
    123     DataSourceConfig config_ = {};
    124     std::vector<std::string> producer_name_filter_;
    125 
    126     // Allows to preserve unknown protobuf fields for compatibility
    127     // with future versions of .proto files.
    128     std::string unknown_fields_;
    129   };
    130 
    131   enum LockdownModeOperation {
    132     LOCKDOWN_UNCHANGED = 0,
    133     LOCKDOWN_CLEAR = 1,
    134     LOCKDOWN_SET = 2,
    135   };
    136 
    137   class PERFETTO_EXPORT ProducerConfig {
    138    public:
    139     ProducerConfig();
    140     ~ProducerConfig();
    141     ProducerConfig(ProducerConfig&&) noexcept;
    142     ProducerConfig& operator=(ProducerConfig&&);
    143     ProducerConfig(const ProducerConfig&);
    144     ProducerConfig& operator=(const ProducerConfig&);
    145 
    146     // Conversion methods from/to the corresponding protobuf types.
    147     void FromProto(const perfetto::protos::TraceConfig_ProducerConfig&);
    148     void ToProto(perfetto::protos::TraceConfig_ProducerConfig*) const;
    149 
    150     const std::string& producer_name() const { return producer_name_; }
    151     void set_producer_name(const std::string& value) { producer_name_ = value; }
    152 
    153     uint32_t shm_size_kb() const { return shm_size_kb_; }
    154     void set_shm_size_kb(uint32_t value) { shm_size_kb_ = value; }
    155 
    156     uint32_t page_size_kb() const { return page_size_kb_; }
    157     void set_page_size_kb(uint32_t value) { page_size_kb_ = value; }
    158 
    159    private:
    160     std::string producer_name_ = {};
    161     uint32_t shm_size_kb_ = {};
    162     uint32_t page_size_kb_ = {};
    163 
    164     // Allows to preserve unknown protobuf fields for compatibility
    165     // with future versions of .proto files.
    166     std::string unknown_fields_;
    167   };
    168 
    169   class PERFETTO_EXPORT StatsdMetadata {
    170    public:
    171     StatsdMetadata();
    172     ~StatsdMetadata();
    173     StatsdMetadata(StatsdMetadata&&) noexcept;
    174     StatsdMetadata& operator=(StatsdMetadata&&);
    175     StatsdMetadata(const StatsdMetadata&);
    176     StatsdMetadata& operator=(const StatsdMetadata&);
    177 
    178     // Conversion methods from/to the corresponding protobuf types.
    179     void FromProto(const perfetto::protos::TraceConfig_StatsdMetadata&);
    180     void ToProto(perfetto::protos::TraceConfig_StatsdMetadata*) const;
    181 
    182     int64_t triggering_alert_id() const { return triggering_alert_id_; }
    183     void set_triggering_alert_id(int64_t value) {
    184       triggering_alert_id_ = value;
    185     }
    186 
    187     int32_t triggering_config_uid() const { return triggering_config_uid_; }
    188     void set_triggering_config_uid(int32_t value) {
    189       triggering_config_uid_ = value;
    190     }
    191 
    192     int64_t triggering_config_id() const { return triggering_config_id_; }
    193     void set_triggering_config_id(int64_t value) {
    194       triggering_config_id_ = value;
    195     }
    196 
    197    private:
    198     int64_t triggering_alert_id_ = {};
    199     int32_t triggering_config_uid_ = {};
    200     int64_t triggering_config_id_ = {};
    201 
    202     // Allows to preserve unknown protobuf fields for compatibility
    203     // with future versions of .proto files.
    204     std::string unknown_fields_;
    205   };
    206 
    207   class PERFETTO_EXPORT GuardrailOverrides {
    208    public:
    209     GuardrailOverrides();
    210     ~GuardrailOverrides();
    211     GuardrailOverrides(GuardrailOverrides&&) noexcept;
    212     GuardrailOverrides& operator=(GuardrailOverrides&&);
    213     GuardrailOverrides(const GuardrailOverrides&);
    214     GuardrailOverrides& operator=(const GuardrailOverrides&);
    215 
    216     // Conversion methods from/to the corresponding protobuf types.
    217     void FromProto(const perfetto::protos::TraceConfig_GuardrailOverrides&);
    218     void ToProto(perfetto::protos::TraceConfig_GuardrailOverrides*) const;
    219 
    220     uint64_t max_upload_per_day_bytes() const {
    221       return max_upload_per_day_bytes_;
    222     }
    223     void set_max_upload_per_day_bytes(uint64_t value) {
    224       max_upload_per_day_bytes_ = value;
    225     }
    226 
    227    private:
    228     uint64_t max_upload_per_day_bytes_ = {};
    229 
    230     // Allows to preserve unknown protobuf fields for compatibility
    231     // with future versions of .proto files.
    232     std::string unknown_fields_;
    233   };
    234 
    235   TraceConfig();
    236   ~TraceConfig();
    237   TraceConfig(TraceConfig&&) noexcept;
    238   TraceConfig& operator=(TraceConfig&&);
    239   TraceConfig(const TraceConfig&);
    240   TraceConfig& operator=(const TraceConfig&);
    241 
    242   // Conversion methods from/to the corresponding protobuf types.
    243   void FromProto(const perfetto::protos::TraceConfig&);
    244   void ToProto(perfetto::protos::TraceConfig*) const;
    245 
    246   int buffers_size() const { return static_cast<int>(buffers_.size()); }
    247   const std::vector<BufferConfig>& buffers() const { return buffers_; }
    248   BufferConfig* add_buffers() {
    249     buffers_.emplace_back();
    250     return &buffers_.back();
    251   }
    252 
    253   int data_sources_size() const {
    254     return static_cast<int>(data_sources_.size());
    255   }
    256   const std::vector<DataSource>& data_sources() const { return data_sources_; }
    257   DataSource* add_data_sources() {
    258     data_sources_.emplace_back();
    259     return &data_sources_.back();
    260   }
    261 
    262   uint32_t duration_ms() const { return duration_ms_; }
    263   void set_duration_ms(uint32_t value) { duration_ms_ = value; }
    264 
    265   bool enable_extra_guardrails() const { return enable_extra_guardrails_; }
    266   void set_enable_extra_guardrails(bool value) {
    267     enable_extra_guardrails_ = value;
    268   }
    269 
    270   LockdownModeOperation lockdown_mode() const { return lockdown_mode_; }
    271   void set_lockdown_mode(LockdownModeOperation value) {
    272     lockdown_mode_ = value;
    273   }
    274 
    275   int producers_size() const { return static_cast<int>(producers_.size()); }
    276   const std::vector<ProducerConfig>& producers() const { return producers_; }
    277   ProducerConfig* add_producers() {
    278     producers_.emplace_back();
    279     return &producers_.back();
    280   }
    281 
    282   const StatsdMetadata& statsd_metadata() const { return statsd_metadata_; }
    283   StatsdMetadata* mutable_statsd_metadata() { return &statsd_metadata_; }
    284 
    285   bool write_into_file() const { return write_into_file_; }
    286   void set_write_into_file(bool value) { write_into_file_ = value; }
    287 
    288   uint32_t file_write_period_ms() const { return file_write_period_ms_; }
    289   void set_file_write_period_ms(uint32_t value) {
    290     file_write_period_ms_ = value;
    291   }
    292 
    293   uint64_t max_file_size_bytes() const { return max_file_size_bytes_; }
    294   void set_max_file_size_bytes(uint64_t value) { max_file_size_bytes_ = value; }
    295 
    296   const GuardrailOverrides& guardrail_overrides() const {
    297     return guardrail_overrides_;
    298   }
    299   GuardrailOverrides* mutable_guardrail_overrides() {
    300     return &guardrail_overrides_;
    301   }
    302 
    303  private:
    304   std::vector<BufferConfig> buffers_;
    305   std::vector<DataSource> data_sources_;
    306   uint32_t duration_ms_ = {};
    307   bool enable_extra_guardrails_ = {};
    308   LockdownModeOperation lockdown_mode_ = {};
    309   std::vector<ProducerConfig> producers_;
    310   StatsdMetadata statsd_metadata_ = {};
    311   bool write_into_file_ = {};
    312   uint32_t file_write_period_ms_ = {};
    313   uint64_t max_file_size_bytes_ = {};
    314   GuardrailOverrides guardrail_overrides_ = {};
    315 
    316   // Allows to preserve unknown protobuf fields for compatibility
    317   // with future versions of .proto files.
    318   std::string unknown_fields_;
    319 };
    320 
    321 }  // namespace perfetto
    322 #endif  // INCLUDE_PERFETTO_TRACING_CORE_TRACE_CONFIG_H_
    323