From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752911AbcGFIvM (ORCPT ); Wed, 6 Jul 2016 04:51:12 -0400 Received: from mail-pa0-f67.google.com ([209.85.220.67]:33542 "EHLO mail-pa0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751172AbcGFIvI (ORCPT ); Wed, 6 Jul 2016 04:51:08 -0400 From: Namhyung Kim To: Arnaldo Carvalho de Melo Cc: Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML , David Ahern , Andi Kleen Subject: [PATCH] perf annotate: Improve error message for symbol filter Date: Wed, 6 Jul 2016 17:50:18 +0900 Message-Id: <1467795018-1828-1-git-send-email-namhyung@kernel.org> X-Mailer: git-send-email 2.8.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When symbol filter is given and it doesn't have a sample, the error message is a bit confusing. Before: $ perf annotate --stdio non_existing_function Error: The perf.data file has no samples! After: $ perf annotate --stdio non_existing_function Error: The non_existing_function symbol has no samples! Signed-off-by: Namhyung Kim --- tools/perf/builtin-annotate.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 9c1034d81b4f..ba8a75ec5801 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c @@ -256,7 +256,13 @@ static int __cmd_annotate(struct perf_annotate *ann) } if (total_nr_samples == 0) { - ui__error("The %s file has no samples!\n", session->file->path); + if (ann->sym_hist_filter) { + ui__error("The %s symbol has no samples!\n", + ann->sym_hist_filter); + } else { + ui__error("The %s file has no samples!\n", + session->file->path); + } goto out; } -- 2.8.0