[perfmon] Rename perfmon_config_t to perfmon_ioctl_config_t
... in preparation for splitting up config into FIDL config and client config.
ZX-3490 #comment patch
Change-Id: If7c0161d389fb238fc5540c3f496c32df7cc4388
diff --git a/garnet/bin/cpuperf/session_spec.h b/garnet/bin/cpuperf/session_spec.h
index 3b9df87..9b08aab 100644
--- a/garnet/bin/cpuperf/session_spec.h
+++ b/garnet/bin/cpuperf/session_spec.h
@@ -40,7 +40,7 @@
std::string model_name;
// Configuration for collecting cpu performance data.
- perfmon_config_t perfmon_config{};
+ perfmon_ioctl_config_t perfmon_config{};
// The size of the trace buffer to use, in MB.
uint32_t buffer_size_in_mb{kDefaultBufferSizeInMb};
diff --git a/garnet/bin/cpuperf_provider/app.cc b/garnet/bin/cpuperf_provider/app.cc
index d4e37ba4..98d806e 100644
--- a/garnet/bin/cpuperf_provider/app.cc
+++ b/garnet/bin/cpuperf_provider/app.cc
@@ -120,7 +120,7 @@
FXL_DCHECK(!context_);
FXL_DCHECK(!controller_);
- perfmon_config_t device_config;
+ perfmon_ioctl_config_t device_config;
if (!trace_config.TranslateToDeviceConfig(&device_config)) {
FXL_LOG(ERROR) << "Error converting trace config to device config";
return;
diff --git a/garnet/bin/cpuperf_provider/categories.cc b/garnet/bin/cpuperf_provider/categories.cc
index 6355bf7..7b66275 100644
--- a/garnet/bin/cpuperf_provider/categories.cc
+++ b/garnet/bin/cpuperf_provider/categories.cc
@@ -182,10 +182,10 @@
return false;
}
-bool TraceConfig::TranslateToDeviceConfig(perfmon_config_t* out_config) const {
+bool TraceConfig::TranslateToDeviceConfig(perfmon_ioctl_config_t* out_config) const {
FXL_CHECK(model_event_manager_);
- perfmon_config_t* cfg = out_config;
+ perfmon_ioctl_config_t* cfg = out_config;
memset(cfg, 0, sizeof(*cfg));
unsigned ctr = 0;
diff --git a/garnet/bin/cpuperf_provider/categories.h b/garnet/bin/cpuperf_provider/categories.h
index 8693a5f..0a72bc7 100644
--- a/garnet/bin/cpuperf_provider/categories.h
+++ b/garnet/bin/cpuperf_provider/categories.h
@@ -102,7 +102,7 @@
bool Changed(const TraceConfig& old) const;
// Translate our representation of the configuration to the device's.
- bool TranslateToDeviceConfig(perfmon_config_t* out_config) const;
+ bool TranslateToDeviceConfig(perfmon_ioctl_config_t* out_config) const;
// Return a string representation of the config for error reporting.
std::string ToString() const;
diff --git a/garnet/bin/cpuperf_provider/importer.cc b/garnet/bin/cpuperf_provider/importer.cc
index c9a9221..f83f1a0 100644
--- a/garnet/bin/cpuperf_provider/importer.cc
+++ b/garnet/bin/cpuperf_provider/importer.cc
@@ -74,7 +74,7 @@
return false;
}
- perfmon_config_t config;
+ perfmon_ioctl_config_t config;
if (!reader.GetConfig(&config)) {
FXL_LOG(ERROR) << "Error reading CPU performance config";
return false;
@@ -90,7 +90,7 @@
uint64_t Importer::ImportRecords(perfmon::DeviceReader& reader,
const perfmon::Properties& props,
- const perfmon_config_t& config) {
+ const perfmon_ioctl_config_t& config) {
EventTracker event_data(start_time_);
uint32_t record_count = 0;
// Only print these warnings once, and then again at the end with
@@ -223,7 +223,7 @@
}
void Importer::ImportSampleRecord(trace_cpu_number_t cpu,
- const perfmon_config_t& config,
+ const perfmon_ioctl_config_t& config,
const perfmon::SampleRecord& record,
trace_ticks_t previous_time,
trace_ticks_t current_time,
@@ -334,7 +334,7 @@
}
void Importer::EmitLastBranchRecord(trace_cpu_number_t cpu,
- const perfmon_config_t& config,
+ const perfmon_ioctl_config_t& config,
const perfmon::SampleRecord& record,
trace_ticks_t time) {
// Use the cpu's name as the blob's name.
@@ -369,7 +369,7 @@
// currently no other way to communicate the start time of the trace in a
// json output file, and thus there would otherwise be no way for the
// report printer to know the duration over which the count was collected.
-void Importer::EmitTallyCounts(const perfmon_config_t& config,
+void Importer::EmitTallyCounts(const perfmon_ioctl_config_t& config,
const EventTracker* event_data) {
unsigned num_cpus = zx_system_get_num_cpus();
diff --git a/garnet/bin/cpuperf_provider/importer.h b/garnet/bin/cpuperf_provider/importer.h
index 53a4848..fd5fb75 100644
--- a/garnet/bin/cpuperf_provider/importer.h
+++ b/garnet/bin/cpuperf_provider/importer.h
@@ -110,10 +110,10 @@
uint64_t ImportRecords(perfmon::DeviceReader& reader,
const perfmon::Properties& props,
- const perfmon_config_t& config);
+ const perfmon_ioctl_config_t& config);
void ImportSampleRecord(trace_cpu_number_t cpu,
- const perfmon_config_t& config,
+ const perfmon_ioctl_config_t& config,
const perfmon::SampleRecord& record,
trace_ticks_t previous_time,
trace_ticks_t current_time, uint64_t ticks_per_second,
@@ -126,11 +126,11 @@
uint64_t ticks_per_second, uint64_t value);
void EmitLastBranchRecord(trace_cpu_number_t cpu,
- const perfmon_config_t& config,
+ const perfmon_ioctl_config_t& config,
const perfmon::SampleRecord& record,
trace_ticks_t time);
- void EmitTallyCounts(const perfmon_config_t& config,
+ void EmitTallyCounts(const perfmon_ioctl_config_t& config,
const EventTracker* event_data);
void EmitTallyRecord(trace_cpu_number_t cpu, perfmon_event_id_t event_id,
diff --git a/garnet/lib/perfmon/controller.cc b/garnet/lib/perfmon/controller.cc
index 9d00a85..e8a9a0e 100644
--- a/garnet/lib/perfmon/controller.cc
+++ b/garnet/lib/perfmon/controller.cc
@@ -20,7 +20,7 @@
const char kPerfMonDev[] = "/dev/sys/cpu-trace/perfmon";
-static Controller::Mode GetMode(const perfmon_config_t& config) {
+static Controller::Mode GetMode(const perfmon_ioctl_config_t& config) {
for (size_t i = 0; i < countof(config.rate); ++i) {
// If any event is doing sampling, then we're in "sample mode".
if (config.rate[i] != 0) {
@@ -83,7 +83,7 @@
bool Controller::Alloc(int fd, uint32_t num_traces,
uint32_t buffer_size_in_pages,
- const perfmon_config_t& config) {
+ const perfmon_ioctl_config_t& config) {
ioctl_perfmon_alloc_t alloc;
alloc.num_buffers = num_traces;
alloc.buffer_size_in_pages = buffer_size_in_pages;
@@ -118,7 +118,7 @@
}
bool Controller::Create(uint32_t buffer_size_in_pages,
- const perfmon_config_t& config,
+ const perfmon_ioctl_config_t& config,
std::unique_ptr<Controller>* out_controller) {
int raw_fd = open(kPerfMonDev, O_WRONLY);
if (raw_fd < 0) {
@@ -151,7 +151,7 @@
Controller::Controller(fxl::UniqueFD fd, Mode mode, uint32_t num_traces,
uint32_t buffer_size_in_pages,
- const perfmon_config_t& config)
+ const perfmon_ioctl_config_t& config)
: fd_(std::move(fd)),
mode_(mode),
num_traces_(num_traces),
diff --git a/garnet/lib/perfmon/controller.h b/garnet/lib/perfmon/controller.h
index 417a697..bae5660 100644
--- a/garnet/lib/perfmon/controller.h
+++ b/garnet/lib/perfmon/controller.h
@@ -39,7 +39,7 @@
static bool GetProperties(Properties* props);
static bool Create(uint32_t buffer_size_in_pages,
- const perfmon_config_t& config,
+ const perfmon_ioctl_config_t& config,
std::unique_ptr<Controller>* out_controller);
~Controller();
@@ -58,9 +58,9 @@
private:
static bool Alloc(int fd, uint32_t num_traces, uint32_t buffer_size_in_pages,
- const perfmon_config_t& config);
+ const perfmon_ioctl_config_t& config);
Controller(fxl::UniqueFD fd, Mode mode, uint32_t num_traces,
- uint32_t buffer_size, const perfmon_config_t& config);
+ uint32_t buffer_size, const perfmon_ioctl_config_t& config);
bool Stage();
void Free();
void Reset();
@@ -71,7 +71,7 @@
uint32_t num_traces_;
// This is the actual buffer size we use, in pages.
const uint32_t buffer_size_in_pages_;
- const perfmon_config_t config_;
+ const perfmon_ioctl_config_t config_;
bool started_ = false;
};
diff --git a/garnet/lib/perfmon/device_reader.cc b/garnet/lib/perfmon/device_reader.cc
index 6e4ee6e..bebfdf0 100644
--- a/garnet/lib/perfmon/device_reader.cc
+++ b/garnet/lib/perfmon/device_reader.cc
@@ -56,7 +56,7 @@
return true;
}
-bool DeviceReader::GetConfig(perfmon_config_t* config) {
+bool DeviceReader::GetConfig(perfmon_ioctl_config_t* config) {
auto status = ioctl_perfmon_get_config(fd_, config);
if (status < 0)
FXL_LOG(ERROR) << "ioctl_perfmon_get_config failed: " << status;
diff --git a/garnet/lib/perfmon/device_reader.h b/garnet/lib/perfmon/device_reader.h
index 2402736d..e8fd2a4 100644
--- a/garnet/lib/perfmon/device_reader.h
+++ b/garnet/lib/perfmon/device_reader.h
@@ -26,7 +26,7 @@
bool GetProperties(Properties* props);
- bool GetConfig(perfmon_config_t* config);
+ bool GetConfig(perfmon_ioctl_config_t* config);
private:
// |fd| is borrowed.
diff --git a/garnet/lib/perfmon/events.cc b/garnet/lib/perfmon/events.cc
index e2eda72..1de7036 100644
--- a/garnet/lib/perfmon/events.cc
+++ b/garnet/lib/perfmon/events.cc
@@ -185,7 +185,7 @@
}
}
-size_t GetConfigEventCount(const perfmon_config_t& config) {
+size_t GetConfigEventCount(const perfmon_ioctl_config_t& config) {
size_t count;
for (count = 0; count < PERFMON_MAX_EVENTS; ++count) {
diff --git a/garnet/lib/perfmon/events.h b/garnet/lib/perfmon/events.h
index f65a70d..efa8e80 100644
--- a/garnet/lib/perfmon/events.h
+++ b/garnet/lib/perfmon/events.h
@@ -107,7 +107,7 @@
// Return the number of events in |config|.
// This function is thread-safe.
-size_t GetConfigEventCount(const perfmon_config_t& config);
+size_t GetConfigEventCount(const perfmon_ioctl_config_t& config);
} // namespace perfmon
diff --git a/zircon/system/dev/misc/cpu-trace/arm64-pm.cpp b/zircon/system/dev/misc/cpu-trace/arm64-pm.cpp
index 85e7e31..3881364 100644
--- a/zircon/system/dev/misc/cpu-trace/arm64-pm.cpp
+++ b/zircon/system/dev/misc/cpu-trace/arm64-pm.cpp
@@ -108,7 +108,7 @@
: ~0ul);
}
-zx_status_t PerfmonDevice::StageFixedConfig(const perfmon_config_t* icfg,
+zx_status_t PerfmonDevice::StageFixedConfig(const perfmon_ioctl_config_t* icfg,
StagingState* ss,
unsigned input_index,
PmuConfig* ocfg) {
@@ -147,7 +147,7 @@
return ZX_OK;
}
-zx_status_t PerfmonDevice::StageProgrammableConfig(const perfmon_config_t* icfg,
+zx_status_t PerfmonDevice::StageProgrammableConfig(const perfmon_ioctl_config_t* icfg,
StagingState* ss,
unsigned input_index,
PmuConfig* ocfg) {
@@ -208,7 +208,7 @@
return ZX_OK;
}
-zx_status_t PerfmonDevice::StageMiscConfig(const perfmon_config_t* icfg,
+zx_status_t PerfmonDevice::StageMiscConfig(const perfmon_ioctl_config_t* icfg,
StagingState* ss,
unsigned input_index,
PmuConfig* ocfg) {
diff --git a/zircon/system/dev/misc/cpu-trace/intel-pm.cpp b/zircon/system/dev/misc/cpu-trace/intel-pm.cpp
index 0306462..8902e8d 100644
--- a/zircon/system/dev/misc/cpu-trace/intel-pm.cpp
+++ b/zircon/system/dev/misc/cpu-trace/intel-pm.cpp
@@ -193,7 +193,7 @@
: ~0ul);
}
-zx_status_t PerfmonDevice::StageFixedConfig(const perfmon_config_t* icfg,
+zx_status_t PerfmonDevice::StageFixedConfig(const perfmon_ioctl_config_t* icfg,
StagingState* ss,
unsigned input_index,
PmuConfig* ocfg) {
@@ -266,7 +266,7 @@
return ZX_OK;
}
-zx_status_t PerfmonDevice::StageProgrammableConfig(const perfmon_config_t* icfg,
+zx_status_t PerfmonDevice::StageProgrammableConfig(const perfmon_ioctl_config_t* icfg,
StagingState* ss,
unsigned input_index,
PmuConfig* ocfg) {
@@ -372,7 +372,7 @@
return ZX_OK;
}
-zx_status_t PerfmonDevice::StageMiscConfig(const perfmon_config_t* icfg,
+zx_status_t PerfmonDevice::StageMiscConfig(const perfmon_ioctl_config_t* icfg,
StagingState* ss,
unsigned input_index,
PmuConfig* ocfg) {
diff --git a/zircon/system/dev/misc/cpu-trace/perf-mon.cpp b/zircon/system/dev/misc/cpu-trace/perf-mon.cpp
index 88a1b30..b46980a 100644
--- a/zircon/system/dev/misc/cpu-trace/perf-mon.cpp
+++ b/zircon/system/dev/misc/cpu-trace/perf-mon.cpp
@@ -290,8 +290,8 @@
// can't be used.
per_trace->configured = false;
- perfmon_config_t ioctl_config;
- perfmon_config_t* icfg = &ioctl_config;
+ perfmon_ioctl_config_t ioctl_config;
+ perfmon_ioctl_config_t* icfg = &ioctl_config;
if (cmdlen != sizeof(*icfg)) {
return ZX_ERR_INVALID_ARGS;
}
@@ -397,7 +397,7 @@
return ZX_ERR_BAD_STATE;
}
- const perfmon_config_t* config = &per_trace->ioctl_config;
+ const perfmon_ioctl_config_t* config = &per_trace->ioctl_config;
if (replymax < sizeof(*config)) {
return ZX_ERR_BUFFER_TOO_SMALL;
}
diff --git a/zircon/system/dev/misc/cpu-trace/perf-mon.h b/zircon/system/dev/misc/cpu-trace/perf-mon.h
index 15243a3..e761c3d 100644
--- a/zircon/system/dev/misc/cpu-trace/perf-mon.h
+++ b/zircon/system/dev/misc/cpu-trace/perf-mon.h
@@ -69,7 +69,7 @@
bool configured;
// The trace configuration as given to us via the ioctl.
- perfmon_config_t ioctl_config;
+ perfmon_ioctl_config_t ioctl_config;
// The internalized form of |ioctl_config| that we pass to the kernel.
PmuConfig config;
@@ -152,15 +152,15 @@
// Initialize |ss| in preparation for processing the PMU configuration.
void InitializeStagingState(StagingState* ss);
// Stage fixed counter |input_index| in |icfg|.
- zx_status_t StageFixedConfig(const perfmon_config_t* icfg,
+ zx_status_t StageFixedConfig(const perfmon_ioctl_config_t* icfg,
StagingState* ss, unsigned input_index,
PmuConfig* ocfg);
// Stage fixed counter |input_index| in |icfg|.
- zx_status_t StageProgrammableConfig(const perfmon_config_t* icfg,
+ zx_status_t StageProgrammableConfig(const perfmon_ioctl_config_t* icfg,
StagingState* ss, unsigned input_index,
PmuConfig* ocfg);
// Stage fixed counter |input_index| in |icfg|.
- zx_status_t StageMiscConfig(const perfmon_config_t* icfg,
+ zx_status_t StageMiscConfig(const perfmon_ioctl_config_t* icfg,
StagingState* ss, unsigned input_index,
PmuConfig* ocfg);
// Verify the result. This is where the architecture can do any last
diff --git a/zircon/system/dev/misc/cpu-trace/perf-mon.md b/zircon/system/dev/misc/cpu-trace/perf-mon.md
index b8b3904..952e7b5 100644
--- a/zircon/system/dev/misc/cpu-trace/perf-mon.md
+++ b/zircon/system/dev/misc/cpu-trace/perf-mon.md
@@ -57,7 +57,7 @@
### *ioctl_perfmon_stage_config*
```
-ssize_t ioctl_perfmon_stage_config(int fd, const perfmon_config_t* config);
+ssize_t ioctl_perfmon_stage_config(int fd, const perfmon_ioctl_config_t* config);
```
Configure data collection. |*config| specifies the events to collect
@@ -69,7 +69,7 @@
### *ioctl_perfmon_get_config*
```
-ssize_t ioctl_perfmon_get_config(int fd, perfmon_config_t* config);
+ssize_t ioctl_perfmon_get_config(int fd, perfmon_ioctl_config_t* config);
```
Fetch the configuration passed in to a preceding call to
diff --git a/zircon/system/ulib/zircon-internal/include/lib/zircon-internal/device/cpu-trace/perf-mon.h b/zircon/system/ulib/zircon-internal/include/lib/zircon-internal/device/cpu-trace/perf-mon.h
index c78a515..016b059 100644
--- a/zircon/system/ulib/zircon-internal/include/lib/zircon-internal/device/cpu-trace/perf-mon.h
+++ b/zircon/system/ulib/zircon-internal/include/lib/zircon-internal/device/cpu-trace/perf-mon.h
@@ -285,7 +285,7 @@
#define PERFMON_PROPERTY_FLAG_HAS_LAST_BRANCH (1u << 0)
} perfmon_ioctl_properties_t;
-// The type of the |rate| field of perfmon_config_t.
+// The type of the |rate| field of perfmon_ioctl_config_t.
typedef uint32_t perfmon_rate_t;
// Passed to STAGE_CONFIG to select the data to be collected.
@@ -330,7 +330,7 @@
// This is only available when the underlying system supports it.
// TODO(dje): Provide knob to specify how many branches.
#define PERFMON_CONFIG_FLAG_LAST_BRANCH (1u << 4)
-} perfmon_config_t;
+} perfmon_ioctl_config_t;
///////////////////////////////////////////////////////////////////////////////
@@ -384,19 +384,19 @@
// Must be called with data collection off and after ALLOC.
// Note: This doesn't actually configure the h/w, this just stages
// the values for subsequent use by START.
-// Input: perfmon_config_t
+// Input: perfmon_ioctl_config_t
#define IOCTL_PERFMON_STAGE_CONFIG \
IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_PERFMON, 4)
IOCTL_WRAPPER_IN(ioctl_perfmon_stage_config, IOCTL_PERFMON_STAGE_CONFIG,
- perfmon_config_t)
+ perfmon_ioctl_config_t)
// Fetch performance monitor specification for a cpu.
// Must be called with data collection off and after STAGE_CONFIG.
-// Output: perfmon_config_t
+// Output: perfmon_ioctl_config_t
#define IOCTL_PERFMON_GET_CONFIG \
IOCTL(IOCTL_KIND_DEFAULT, IOCTL_FAMILY_PERFMON, 5)
IOCTL_WRAPPER_OUT(ioctl_perfmon_get_config, IOCTL_PERFMON_GET_CONFIG,
- perfmon_config_t)
+ perfmon_ioctl_config_t)
typedef struct {
uint32_t descriptor;