Re: [lttng-dev] [PATCH v2] mm: Rename mm_vmscan_lru_shrink_inactive trace event variables

2019-05-22 Thread Sebastien Boisvert



On 2019-05-22 6:17 a.m., Kirill Tkhai wrote:
> Rename nr_activate{0,1} into nr_activate{anon,file} since this

Rename nr_activate{0,1} into nr_activate{anon,file}
^
 add an underscore here
 (nr_activate_anon, nr_activate_file).


> is exported into userspace, e.g., it's shown here:
> 
> /sys/kernel/debug/tracing/events/vmscan/mm_vmscan_lru_shrink_inactive/format
> 
> v2: Changed suggested person (sorry, Mathieu :))
> 
> Suggested-by: Mathieu Desnoyers 
> Signed-off-by: Kirill Tkhai 
> ---
>  include/trace/events/vmscan.h |   10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h
> index a5ab2973e8dc..c316279715f4 100644
> --- a/include/trace/events/vmscan.h
> +++ b/include/trace/events/vmscan.h
> @@ -348,8 +348,8 @@ TRACE_EVENT(mm_vmscan_lru_shrink_inactive,
>   __field(unsigned long, nr_writeback)
>   __field(unsigned long, nr_congested)
>   __field(unsigned long, nr_immediate)
> - __field(unsigned int, nr_activate0)
> - __field(unsigned int, nr_activate1)
> + __field(unsigned int, nr_activate_anon)
> + __field(unsigned int, nr_activate_file)
>   __field(unsigned long, nr_ref_keep)
>   __field(unsigned long, nr_unmap_fail)
>   __field(int, priority)
> @@ -364,8 +364,8 @@ TRACE_EVENT(mm_vmscan_lru_shrink_inactive,
>   __entry->nr_writeback = stat->nr_writeback;
>   __entry->nr_congested = stat->nr_congested;
>   __entry->nr_immediate = stat->nr_immediate;
> - __entry->nr_activate0 = stat->nr_activate[0];
> - __entry->nr_activate1 = stat->nr_activate[1];
> + __entry->nr_activate_anon = stat->nr_activate[0];
> + __entry->nr_activate_file = stat->nr_activate[1];
>   __entry->nr_ref_keep = stat->nr_ref_keep;
>   __entry->nr_unmap_fail = stat->nr_unmap_fail;
>   __entry->priority = priority;
> @@ -377,7 +377,7 @@ TRACE_EVENT(mm_vmscan_lru_shrink_inactive,
>   __entry->nr_scanned, __entry->nr_reclaimed,
>   __entry->nr_dirty, __entry->nr_writeback,
>   __entry->nr_congested, __entry->nr_immediate,
> - __entry->nr_activate0, __entry->nr_activate1,
> + __entry->nr_activate_anon, __entry->nr_activate_file,
>   __entry->nr_ref_keep, __entry->nr_unmap_fail,
>   __entry->priority,
>   show_reclaim_flags(__entry->reclaim_flags))
> ___
> lttng-dev mailing list
> lttng-...@lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
> 


Re: [PATCH 03/11] perf tools report: Support nano seconds

2019-02-25 Thread Sebastien Boisvert



On 2019-02-24 10:37 a.m., Andi Kleen wrote:
> From: Andi Kleen 
> 
> Upcoming changes add timestamp output in perf report. Add a --ns
> argument similar to perf script to support nanoseconds resolution
> when needed.

Is this a ISO-8601 date with nanoseconds ?

> 
> Signed-off-by: Andi Kleen 
> ---
>  tools/perf/Documentation/perf-report.txt | 3 +++
>  tools/perf/builtin-report.c  | 1 +
>  tools/perf/builtin-script.c  | 1 -
>  tools/perf/util/sort.c   | 1 +
>  tools/perf/util/sort.h   | 2 ++
>  5 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/Documentation/perf-report.txt 
> b/tools/perf/Documentation/perf-report.txt
> index 1a27bfe05039..51dbc519dbce 100644
> --- a/tools/perf/Documentation/perf-report.txt
> +++ b/tools/perf/Documentation/perf-report.txt
> @@ -477,6 +477,9 @@ include::itrace.txt[]
>   Please note that not all mmaps are stored, options affecting which ones
>   are include 'perf record --data', for instance.
>  
> +--ns::
> + Show time stamps in nanoseconds.
> +
>  --stats::
>   Display overall events statistics without any further processing.
>   (like the one at the end of the perf report -D command)
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index 2e8c74d6430c..bb8918a747ba 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -1147,6 +1147,7 @@ int cmd_report(int argc, const char **argv)
>   OPT_CALLBACK(0, "percent-type", _opts, "local-period",
>"Set percent type local/global-period/hits",
>annotate_parse_percent_type),
> + OPT_BOOLEAN(0, "ns", , "Show times in nanosecs"),
>   OPT_END()
>   };
>   struct perf_data data = {
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index 261055302d08..628c04543974 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -59,7 +59,6 @@ static bool no_callchain;
>  static bool  latency_format;
>  static bool  system_wide;
>  static bool  print_flags;
> -static bool  nanosecs;
>  static const char*cpu_list;
>  static DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
>  static struct perf_stat_config   stat_config;
> diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
> index 2b6c1ccb878c..d1010a966f9b 100644
> --- a/tools/perf/util/sort.c
> +++ b/tools/perf/util/sort.c
> @@ -31,6 +31,7 @@ const char  *field_order;
>  regex_t  ignore_callees_regex;
>  int  have_ignore_callees = 0;
>  enum sort_mode   sort__mode = SORT_MODE__NORMAL;
> +bool nanosecs = false;
>  
>  /*
>   * Replaces all occurrences of a char used with the:
> diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
> index 2fbee0b1011c..98223d952404 100644
> --- a/tools/perf/util/sort.h
> +++ b/tools/perf/util/sort.h
> @@ -278,6 +278,8 @@ struct sort_entry {
>  extern struct sort_entry sort_thread;
>  extern struct list_head hist_entry__sort_list;
>  
> +extern bool nanosecs;
> +
>  struct perf_evlist;
>  struct tep_handle;
>  int setup_sorting(struct perf_evlist *evlist);
> 


Re: [PATCH] perf/stat: Handle different PMU names with common prefix

2018-10-29 Thread Sebastien Boisvert



On 2018-10-29 8:18 a.m., Thomas-Mich Richter wrote:
> Yes, mistake on my side...
> but it is the same type of error , regardless if 6 or 7 characters are 
> compared:
> 
>   strncmp("cpmu_cf", "cpum_cf_diag", 7) 
> 
> returns 0 when it should not. The device names of both PMUs are different.
> 

OK, that works then.

You want to do a full-length comparison of PMU names, instead of comparing 
prefixes.

Reviewed-by: Sebastien Boisvert 



Re: [PATCH] perf/stat: Handle different PMU names with common prefix

2018-10-29 Thread Sebastien Boisvert



On 2018-10-29 8:18 a.m., Thomas-Mich Richter wrote:
> Yes, mistake on my side...
> but it is the same type of error , regardless if 6 or 7 characters are 
> compared:
> 
>   strncmp("cpmu_cf", "cpum_cf_diag", 7) 
> 
> returns 0 when it should not. The device names of both PMUs are different.
> 

OK, that works then.

You want to do a full-length comparison of PMU names, instead of comparing 
prefixes.

Reviewed-by: Sebastien Boisvert 



[PATCH] pfn_t: force '~' to be parsed as an unary operator

2018-10-21 Thread Sebastien Boisvert
Tracing the event "fs_dax:dax_pmd_insert_mapping" with perf produces this
warning:
  [fs_dax:dax_pmd_insert_mapping] unknown op '~'

It is printed in process_op (tools/lib/traceevent/event-parse.c) because '~'
is parsed as a binary operator.

perf reads the format of fs_dax:dax_pmd_insert_mapping ("print fmt") from
/sys/kernel/debug/tracing/events/fs_dax/dax_pmd_insert_mapping/format .

The format contains:

~(((u64) ~(~(((1UL) << 12)-1)))
 ^
 \ interpreted as a binary operator by process_op().

This part is generated in the declaration of the event class
dax_pmd_insert_mapping_class in include/trace/events/fs_dax.h :

__print_flags_u64(__entry->pfn_val & PFN_FLAGS_MASK, "|",
PFN_FLAGS_TRACE),

This patch adds a pair of parentheses in the declaration of PFN_FLAGS_MASK to
make sure that '~' is parsed as a unary operator by perf.

The part of the format that was problematic is now:

~(((u64) (~(~(((1UL) << 12)-1

Now, all the '~' are parsed as unary operators.

Cc: Dan Williams 
Cc: "Steven Rostedt (VMware)" 
Cc: Arnaldo Carvalho de Melo 
Cc: "Tzvetomir Stoyanov (VMware)" 
Cc: Namhyung Kim 
Cc: Ross Zwisler 
Cc: Elenie Godzaridis 
Cc: linux-perf-us...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Sebastien Boisvert 
---
 include/linux/pfn_t.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/pfn_t.h b/include/linux/pfn_t.h
index 21713dc14ce2..673546ba7342 100644
--- a/include/linux/pfn_t.h
+++ b/include/linux/pfn_t.h
@@ -10,7 +10,7 @@
  * PFN_DEV - pfn is not covered by system memmap by default
  * PFN_MAP - pfn has a dynamic page mapping established by a device driver
  */
-#define PFN_FLAGS_MASK (((u64) ~PAGE_MASK) << (BITS_PER_LONG_LONG - 
PAGE_SHIFT))
+#define PFN_FLAGS_MASK (((u64) (~PAGE_MASK)) << (BITS_PER_LONG_LONG - 
PAGE_SHIFT))
 #define PFN_SG_CHAIN (1ULL << (BITS_PER_LONG_LONG - 1))
 #define PFN_SG_LAST (1ULL << (BITS_PER_LONG_LONG - 2))
 #define PFN_DEV (1ULL << (BITS_PER_LONG_LONG - 3))
-- 
2.17.1



[PATCH] pfn_t: force '~' to be parsed as an unary operator

2018-10-21 Thread Sebastien Boisvert
Tracing the event "fs_dax:dax_pmd_insert_mapping" with perf produces this
warning:
  [fs_dax:dax_pmd_insert_mapping] unknown op '~'

It is printed in process_op (tools/lib/traceevent/event-parse.c) because '~'
is parsed as a binary operator.

perf reads the format of fs_dax:dax_pmd_insert_mapping ("print fmt") from
/sys/kernel/debug/tracing/events/fs_dax/dax_pmd_insert_mapping/format .

The format contains:

~(((u64) ~(~(((1UL) << 12)-1)))
 ^
 \ interpreted as a binary operator by process_op().

This part is generated in the declaration of the event class
dax_pmd_insert_mapping_class in include/trace/events/fs_dax.h :

__print_flags_u64(__entry->pfn_val & PFN_FLAGS_MASK, "|",
PFN_FLAGS_TRACE),

This patch adds a pair of parentheses in the declaration of PFN_FLAGS_MASK to
make sure that '~' is parsed as a unary operator by perf.

The part of the format that was problematic is now:

~(((u64) (~(~(((1UL) << 12)-1

Now, all the '~' are parsed as unary operators.

Cc: Dan Williams 
Cc: "Steven Rostedt (VMware)" 
Cc: Arnaldo Carvalho de Melo 
Cc: "Tzvetomir Stoyanov (VMware)" 
Cc: Namhyung Kim 
Cc: Ross Zwisler 
Cc: Elenie Godzaridis 
Cc: linux-perf-us...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Sebastien Boisvert 
---
 include/linux/pfn_t.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/pfn_t.h b/include/linux/pfn_t.h
index 21713dc14ce2..673546ba7342 100644
--- a/include/linux/pfn_t.h
+++ b/include/linux/pfn_t.h
@@ -10,7 +10,7 @@
  * PFN_DEV - pfn is not covered by system memmap by default
  * PFN_MAP - pfn has a dynamic page mapping established by a device driver
  */
-#define PFN_FLAGS_MASK (((u64) ~PAGE_MASK) << (BITS_PER_LONG_LONG - 
PAGE_SHIFT))
+#define PFN_FLAGS_MASK (((u64) (~PAGE_MASK)) << (BITS_PER_LONG_LONG - 
PAGE_SHIFT))
 #define PFN_SG_CHAIN (1ULL << (BITS_PER_LONG_LONG - 1))
 #define PFN_SG_LAST (1ULL << (BITS_PER_LONG_LONG - 2))
 #define PFN_DEV (1ULL << (BITS_PER_LONG_LONG - 3))
-- 
2.17.1