From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932072AbcARJYo (ORCPT ); Mon, 18 Jan 2016 04:24:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46826 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754433AbcARJYl (ORCPT ); Mon, 18 Jan 2016 04:24:41 -0500 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , David Ahern , Ingo Molnar , Namhyung Kim , Peter Zijlstra Subject: [PATCH 06/26] perf tools: Add hpp__equal callback function Date: Mon, 18 Jan 2016 10:24:04 +0100 Message-Id: <1453109064-1026-7-git-send-email-jolsa@kernel.org> In-Reply-To: <1453109064-1026-1-git-send-email-jolsa@kernel.org> References: <1453109064-1026-1-git-send-email-jolsa@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding hpp__equal callback function to compare hpp output format entries. Link: http://lkml.kernel.org/n/tip-3amekjgmmufx5lz7slhpmqx3@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/ui/hist.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index 71c8bb71a350..b543f4b7d7d3 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c @@ -371,6 +371,19 @@ static int64_t hpp__nop_cmp(struct perf_hpp_fmt *fmt __maybe_unused, return 0; } +static bool perf_hpp__is_hpp_entry(struct perf_hpp_fmt *a) +{ + return a->header == hpp__header_fn; +} + +static bool hpp__equal(struct perf_hpp_fmt *a, struct perf_hpp_fmt *b) +{ + if (!perf_hpp__is_hpp_entry(a) || !perf_hpp__is_hpp_entry(b)) + return false; + + return a->idx == b->idx; +} + #define HPP__COLOR_PRINT_FNS(_name, _fn, _idx) \ { \ .name = _name, \ @@ -382,6 +395,7 @@ static int64_t hpp__nop_cmp(struct perf_hpp_fmt *fmt __maybe_unused, .collapse = hpp__nop_cmp, \ .sort = hpp__sort_ ## _fn, \ .idx = PERF_HPP__ ## _idx, \ + .equal = hpp__equal, \ } #define HPP__COLOR_ACC_PRINT_FNS(_name, _fn, _idx) \ @@ -395,6 +409,7 @@ static int64_t hpp__nop_cmp(struct perf_hpp_fmt *fmt __maybe_unused, .collapse = hpp__nop_cmp, \ .sort = hpp__sort_ ## _fn, \ .idx = PERF_HPP__ ## _idx, \ + .equal = hpp__equal, \ } #define HPP__PRINT_FNS(_name, _fn, _idx) \ @@ -407,6 +422,7 @@ static int64_t hpp__nop_cmp(struct perf_hpp_fmt *fmt __maybe_unused, .collapse = hpp__nop_cmp, \ .sort = hpp__sort_ ## _fn, \ .idx = PERF_HPP__ ## _idx, \ + .equal = hpp__equal, \ } struct perf_hpp_fmt perf_hpp__format[] = { -- 2.4.3