Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1583893pxy; Fri, 23 Apr 2021 11:31:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxT+ZmMKxF7P4GtOB4z4cgG8pDwVhmBUZS49X9N4b+FCiC3DVhhh0JczdgMDobqGTZE5sKo X-Received: by 2002:a17:907:20f0:: with SMTP id rh16mr5922441ejb.320.1619202713210; Fri, 23 Apr 2021 11:31:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619202713; cv=none; d=google.com; s=arc-20160816; b=DQJVqNpSlxNROyCNY5X0gHDvFjTpiofhIFNNxHGxSW9Fx3PKyiQs87XeYoMmCgiSne C0Ry3Ha4Oz6s9RiX8wd/8rVQSma6TofB2nvhQBbvpFTY8k1s1cxReY+lGGj67OZTTKpD as7AW+QonDuRyFwd1pZ70dF6TYdxiyOxUExbuOjcsIWgiFmbocrhmKUrIL1M/QrFKWED Lp8Pg3LzkK4blWjuTRPnQR4+yl9k4DNeIcwwgnFEYJ1VaD1yTDHOGPrBisq/kt7oThf8 V2cC3bPJrvng6zTvlTk4UOSMsHFPEogTATxLocBO9PWBgauwfhH7Jbk8yNDpvAmv4EhR 0iHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=mE6rQee6kWh13givt51gTVPRCLz+zTbnJEBwrgnDe5E=; b=Oe5LtZXGeRAUzOcpRnRPqCs+J6GstlC2aF08ZQkYhBXxS1uWuGrHuM5ZytE0yoQUsx ufOuvW+Em26qTCdS/kvHzj12m8umx0Wb2frosKNedgunoi+M+AwApAVP+uGI0CiSrZY5 CkHb+rFakvz4nfcSEbyb+z7MSjMib7egssYarIITaHdJB4LZd0BLnJgqGf094pR4NoXO dAy1PD5HWDgOJ8eNYueL670ZHxAOh4BZS/FXMnefHgQhOpWowLV/Os5+A7N1SrERMgJO cYDi9jjvZxkqo922XFDfzGrTAWsNWMD2bS0TPQzmwEgwCEyuAqFvAnv7q89eUCSDnAf6 fPWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BFAwE528; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rh1si5842708ejb.454.2021.04.23.11.31.29; Fri, 23 Apr 2021 11:31:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BFAwE528; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243485AbhDWS25 (ORCPT + 99 others); Fri, 23 Apr 2021 14:28:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243453AbhDWS24 (ORCPT ); Fri, 23 Apr 2021 14:28:56 -0400 Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 660E3C06174A for ; Fri, 23 Apr 2021 11:28:18 -0700 (PDT) Received: by mail-qk1-x72f.google.com with SMTP id z2so13563390qkb.9 for ; Fri, 23 Apr 2021 11:28:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mE6rQee6kWh13givt51gTVPRCLz+zTbnJEBwrgnDe5E=; b=BFAwE528inFfWVZoRdelS82n/e8RGGuqJiXcHYT/GeSG0AbjMYMZJPEMLU6pV+VOk9 YIOP6GsYxq0/WGN8Us2XjcA0pnJLD0i5xZ+JQq3VaA+prdugZYSW+SVCzppvrQWMTCoq RrxyHdWhaOr9R0Rv3tSnGTPJpoQLuQmXCQ2SyhlVBxPa6wEl5gFUxTvptE86qwkmYzIl pmHvHdyslf0hiDX98dE8q6AU4kyP7Lt4GIGBctbuEuGxRnxZKtu0pAYzVjiFqk6l6+S4 jzaY39opc2cOi/DY7CuBzA/x3KwS6BPk6z0O12htMi2905RsupHxYBQmI+DTr02gpl4F Or7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=mE6rQee6kWh13givt51gTVPRCLz+zTbnJEBwrgnDe5E=; b=ktoZlquPUyVl78kZ3+yvPE+FyRP8XdvlOd5sSipgap21ImZqaOo9LFiWLpmJCiN24p oFvGK11xMm5XB92+Myu5hBbj9tQ+UFeOvtSleiE1B7wqlzhTXSQ37fiDZ8zm6PjCHF/p /yfwdvGGdzR9DrYl4ud+YSKYDY06UFQXndXbB2+YeVurHT4PD4s4R5baTZ2NmSTKJBwr kZxh+t0huCGdvrNhx0VK6ULFuQZDF9LgghMATfRtGoxOg1ksq2HduHnEQopF3jvwQtQV lStaobkP+ySQnPP4A2j1Ybyxse9VVTSYK04JNtyzu1pAEqQ/Rcip35EGWCYCwkTjWedv HLVQ== X-Gm-Message-State: AOAM532JoglMG2B9lGjDzLBTxk3l0ClFIQiAHE5w6BOEWWXUqcu9+5bi e1sEqWzB/awCrSg8Aaaq+ZU= X-Received: by 2002:ae9:ec1a:: with SMTP id h26mr5415133qkg.238.1619202497687; Fri, 23 Apr 2021 11:28:17 -0700 (PDT) Received: from balhae.roam.corp.google.com ([50.238.223.130]) by smtp.gmail.com with ESMTPSA id c5sm4783863qkl.7.2021.04.23.11.28.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Apr 2021 11:28:17 -0700 (PDT) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ingo Molnar , Peter Zijlstra , Mark Rutland , Alexander Shishkin , LKML , Andi Kleen , Ian Rogers Subject: [PATCH 1/5] perf top: Use evlist->events_stat to count events Date: Fri, 23 Apr 2021 11:28:09 -0700 Message-Id: <20210423182813.1472902-2-namhyung@kernel.org> X-Mailer: git-send-email 2.31.1.498.g6c1eba8ee3d-goog In-Reply-To: <20210423182813.1472902-1-namhyung@kernel.org> References: <20210423182813.1472902-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's mainly to count lost events for the warning so it should be ok to use the evlist->stats instead. This is needed for changes in the next commit. Signed-off-by: Namhyung Kim --- tools/perf/builtin-top.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 173ace43f845..69cb3635f5ef 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -328,13 +328,13 @@ static void perf_top__print_sym_table(struct perf_top *top) printf("%-*.*s\n", win_width, win_width, graph_dotted_line); if (!top->record_opts.overwrite && - (hists->stats.nr_lost_warned != - hists->stats.nr_events[PERF_RECORD_LOST])) { - hists->stats.nr_lost_warned = - hists->stats.nr_events[PERF_RECORD_LOST]; + (top->evlist->stats.nr_lost_warned != + top->evlist->stats.nr_events[PERF_RECORD_LOST])) { + top->evlist->stats.nr_lost_warned = + top->evlist->stats.nr_events[PERF_RECORD_LOST]; color_fprintf(stdout, PERF_COLOR_RED, "WARNING: LOST %d chunks, Check IO/CPU overload", - hists->stats.nr_lost_warned); + top->evlist->stats.nr_lost_warned); ++printed; } @@ -852,11 +852,9 @@ static void perf_top__process_lost(struct perf_top *top, union perf_event *event, struct evsel *evsel) { - struct hists *hists = evsel__hists(evsel); - top->lost += event->lost.lost; top->lost_total += event->lost.lost; - hists->stats.total_lost += event->lost.lost; + evsel->evlist->stats.total_lost += event->lost.lost; } static void @@ -864,11 +862,9 @@ perf_top__process_lost_samples(struct perf_top *top, union perf_event *event, struct evsel *evsel) { - struct hists *hists = evsel__hists(evsel); - top->lost += event->lost_samples.lost; top->lost_total += event->lost_samples.lost; - hists->stats.total_lost_samples += event->lost_samples.lost; + evsel->evlist->stats.total_lost_samples += event->lost_samples.lost; } static u64 last_timestamp; @@ -1205,7 +1201,7 @@ static int deliver_event(struct ordered_events *qe, } else if (event->header.type == PERF_RECORD_LOST_SAMPLES) { perf_top__process_lost_samples(top, event, evsel); } else if (event->header.type < PERF_RECORD_MAX) { - hists__inc_nr_events(evsel__hists(evsel), event->header.type); + events_stats__inc(&session->evlist->stats, event->header.type); machine__process_event(machine, event, &sample); } else ++session->evlist->stats.nr_unknown_events; -- 2.31.1.498.g6c1eba8ee3d-goog