From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754020AbdHWNBv (ORCPT ); Wed, 23 Aug 2017 09:01:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36428 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753953AbdHWNBu (ORCPT ); Wed, 23 Aug 2017 09:01:50 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9732A7EA96 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jolsa@redhat.com Date: Wed, 23 Aug 2017 15:01:48 +0200 From: Jiri Olsa To: Andi Kleen Cc: peterz@infradead.org, acme@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen , Joe Mario Subject: Re: [PATCH v5 3/4] perf, tools: Add support for printing new mem_info encodings Message-ID: <20170823130148.GA7736@krava> References: <20170816222156.19953-1-andi@firstfloor.org> <20170816222156.19953-4-andi@firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170816222156.19953-4-andi@firstfloor.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 23 Aug 2017 13:01:50 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 16, 2017 at 03:21:55PM -0700, Andi Kleen wrote: SNIP > int perf_mem__lvl_scnprintf(char *out, size_t sz, struct mem_info *mem_info) > { > size_t i, l = 0; > u64 m = PERF_MEM_LVL_NA; > u64 hit, miss; > + int printed; > > if (mem_info) > m = mem_info->data_src.mem_lvl; > @@ -184,17 +193,37 @@ int perf_mem__lvl_scnprintf(char *out, size_t sz, struct mem_info *mem_info) > /* already taken care of */ > m &= ~(PERF_MEM_LVL_HIT|PERF_MEM_LVL_MISS); > > + > + if (mem_info && mem_info->data_src.mem_remote) { > + strcat(out, "Remote "); > + l += 7; > + } Andi, how is this 'Remote' different from the remote levels in mem_lvl? "Remote RAM (1 hop)", "Remote RAM (2 hops)", "Remote Cache (1 hop)", "Remote Cache (2 hops)", thanks, jirka > + > + printed = 0; > for (i = 0; m && i < ARRAY_SIZE(mem_lvl); i++, m >>= 1) { > if (!(m & 0x1)) > continue; > - if (l) { > + if (printed++) { > strcat(out, " or "); > l += 4; > } > l += scnprintf(out + l, sz - l, mem_lvl[i]); > } > - if (*out == '\0') > - l += scnprintf(out, sz - l, "N/A"); > + > + if (mem_info && mem_info->data_src.mem_lvl_num) { > + int lvl = mem_info->data_src.mem_lvl_num; > + if (printed++) { > + strcat(out, " or "); > + l += 4; > + } > + if (mem_lvlnum[lvl]) > + l += scnprintf(out + l, sz - l, mem_lvlnum[lvl]); > + else > + l += scnprintf(out + l, sz - l, "L%d", lvl); > + }