[v3,1/9] perf evlist: introduce control file descriptors
diff mbox series

Message ID 3a1ed73d-6d11-eeb1-0897-476c5367369d@linux.intel.com
State New
Headers show
Series
  • perf: support enable and disable commands in stat and record modes
Related show

Commit Message

Alexey Budankov May 13, 2020, 7:59 a.m. UTC
Define and initialize control file descriptors.

Signed-off-by: Alexey Budankov <alexey.budankov@linux.intel.com>
---
 tools/perf/util/evlist.c | 3 +++
 tools/perf/util/evlist.h | 3 +++
 2 files changed, 6 insertions(+)

Comments

Jiri Olsa May 20, 2020, 12:38 p.m. UTC | #1
On Wed, May 13, 2020 at 10:59:00AM +0300, Alexey Budankov wrote:
> 
> Define and initialize control file descriptors.
> 
> Signed-off-by: Alexey Budankov <alexey.budankov@linux.intel.com>
> ---
>  tools/perf/util/evlist.c | 3 +++
>  tools/perf/util/evlist.h | 3 +++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> index 2a9de6491700..aa61619fa304 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -63,6 +63,9 @@ void evlist__init(struct evlist *evlist, struct perf_cpu_map *cpus,
>  	perf_evlist__set_maps(&evlist->core, cpus, threads);
>  	evlist->workload.pid = -1;
>  	evlist->bkw_mmap_state = BKW_MMAP_NOTREADY;
> +	evlist->ctl_fd = -1;
> +	evlist->ctl_fd_ack = -1;
> +	evlist->ctl_fd_pos = -1;
>  }
>  
>  struct evlist *evlist__new(void)
> diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
> index b6f325dfb4d2..62f259d89b41 100644
> --- a/tools/perf/util/evlist.h
> +++ b/tools/perf/util/evlist.h
> @@ -74,6 +74,9 @@ struct evlist {
>  		pthread_t		th;
>  		volatile int		done;
>  	} thread;
> +	int		ctl_fd;
> +	int		ctl_fd_ack;
> +	int		ctl_fd_pos;

we are using the anonymous structs to keep related
parts together like for workload and thread

could you use it in there as well?

jirka

>  };
>  
>  struct evsel_str_handler {
> -- 
> 2.24.1
>
Alexey Budankov May 20, 2020, 2:46 p.m. UTC | #2
On 20.05.2020 15:38, Jiri Olsa wrote:
> On Wed, May 13, 2020 at 10:59:00AM +0300, Alexey Budankov wrote:
>>
>> Define and initialize control file descriptors.
>>
>> Signed-off-by: Alexey Budankov <alexey.budankov@linux.intel.com>
>> ---
>>  tools/perf/util/evlist.c | 3 +++
>>  tools/perf/util/evlist.h | 3 +++
>>  2 files changed, 6 insertions(+)
>>
>> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
>> index 2a9de6491700..aa61619fa304 100644
>> --- a/tools/perf/util/evlist.c
>> +++ b/tools/perf/util/evlist.c
>> @@ -63,6 +63,9 @@ void evlist__init(struct evlist *evlist, struct perf_cpu_map *cpus,
>>  	perf_evlist__set_maps(&evlist->core, cpus, threads);
>>  	evlist->workload.pid = -1;
>>  	evlist->bkw_mmap_state = BKW_MMAP_NOTREADY;
>> +	evlist->ctl_fd = -1;
>> +	evlist->ctl_fd_ack = -1;
>> +	evlist->ctl_fd_pos = -1;
>>  }
>>  
>>  struct evlist *evlist__new(void)
>> diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
>> index b6f325dfb4d2..62f259d89b41 100644
>> --- a/tools/perf/util/evlist.h
>> +++ b/tools/perf/util/evlist.h
>> @@ -74,6 +74,9 @@ struct evlist {
>>  		pthread_t		th;
>>  		volatile int		done;
>>  	} thread;
>> +	int		ctl_fd;
>> +	int		ctl_fd_ack;
>> +	int		ctl_fd_pos;
> 
> we are using the anonymous structs to keep related
> parts together like for workload and thread
> 
> could you use it in there as well?

Accepted in v4.

~Alexey

> 
> jirka
> 
>>  };
>>  
>>  struct evsel_str_handler {
>> -- 
>> 2.24.1
>>
>

Patch
diff mbox series

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 2a9de6491700..aa61619fa304 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -63,6 +63,9 @@  void evlist__init(struct evlist *evlist, struct perf_cpu_map *cpus,
 	perf_evlist__set_maps(&evlist->core, cpus, threads);
 	evlist->workload.pid = -1;
 	evlist->bkw_mmap_state = BKW_MMAP_NOTREADY;
+	evlist->ctl_fd = -1;
+	evlist->ctl_fd_ack = -1;
+	evlist->ctl_fd_pos = -1;
 }
 
 struct evlist *evlist__new(void)
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index b6f325dfb4d2..62f259d89b41 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -74,6 +74,9 @@  struct evlist {
 		pthread_t		th;
 		volatile int		done;
 	} thread;
+	int		ctl_fd;
+	int		ctl_fd_ack;
+	int		ctl_fd_pos;
 };
 
 struct evsel_str_handler {