On Wed, Feb 3, 2021 at 5:14 AM <[email protected]> wrote:
>
> From: Kan Liang <[email protected]>
>
> Two new data source fields, to indicate the block reasons of a load
> instruction, are introduced on the Intel Sapphire Rapids server. The
> fields can be used by the memory profiling.
>
> Add a new sort function, SORT_MEM_BLOCKED, for the two fields.
>
> For the previous platforms or the block reason is unknown, print "N/A"
> for the block reason.
>
> Add blocked as a default mem sort key for perf report and
> perf mem report.
>
> Signed-off-by: Kan Liang <[email protected]>
> ---
[SNIP]
> +int perf_mem__blk_scnprintf(char *out, size_t sz, struct mem_info *mem_info)
> +{
> +       size_t l = 0;
> +       u64 mask = PERF_MEM_BLK_NA;
> +
> +       sz -= 1; /* -1 for null termination */
> +       out[0] = '\0';
> +
> +       if (mem_info)
> +               mask = mem_info->data_src.mem_blk;
> +
> +       if (!mask || (mask & PERF_MEM_BLK_NA)) {
> +               l += scnprintf(out + l, sz - l, " N/A");
> +               return l;
> +       }
> +       if (mask & PERF_MEM_BLK_DATA)
> +               l += scnprintf(out + l, sz - l, " Data");
> +       if (mask & PERF_MEM_BLK_ADDR)
> +               l += scnprintf(out + l, sz - l, " Addr");

So this means it's possible to have BLK_DATA and BLK_ADDR
together and in that case it'll print "DataAddr", right?

Thanks,
Namhyung


> +
> +       return l;
> +}
> +
>  int perf_script__meminfo_scnprintf(char *out, size_t sz, struct mem_info 
> *mem_info)
>  {
>         int i = 0;
> @@ -348,6 +371,8 @@ int perf_script__meminfo_scnprintf(char *out, size_t sz, 
> struct mem_info *mem_in
>         i += perf_mem__tlb_scnprintf(out + i, sz - i, mem_info);
>         i += scnprintf(out + i, sz - i, "|LCK ");
>         i += perf_mem__lck_scnprintf(out + i, sz - i, mem_info);
> +       i += scnprintf(out + i, sz - i, "|BLK ");
> +       i += perf_mem__blk_scnprintf(out + i, sz - i, mem_info);
>
>         return i;
>  }

Reply via email to