From patchwork Thu Mar 28 13:07:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 1109703 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-502277-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ey1RhToU"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45J5772YGPz9s1c for ; Tue, 4 Jun 2019 18:43:45 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :resent-from:resent-to:resent-date:resent-message-id:message-id :in-reply-to:references:from:date:subject:to:mime-version :content-type; q=dns; s=default; b=dZi4rEsmzZLDrRsyfALeJ2WIUvw1w F7XtMqjfRTpcn5goNY675ZQegGAV9dKK4uenhZXTLyxZAxqIjtXbACTG50zWP24O tLNH0nWAC8cFB/qWdy6sBqY68nzEwAnIMec/ETo4pynlSI85Gy3ASVpGoEIhJFap US5FMkv9DiUalI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :resent-from:resent-to:resent-date:resent-message-id:message-id :in-reply-to:references:from:date:subject:to:mime-version :content-type; s=default; bh=kLkn6QQcuegTb5Vfl2f1v2EJIK4=; b=ey1 RhToU8jMjL8Y8vPI7BaQKkO+9nnemUYeCVHXGQzhUi40N+tXn7AOj3tRKRiltbyf Eu5eZHhqOs812Nn9WrM1f0Reobo2PHUucHM99VH3+jBMNHpICq/dzR33OYmUgdIQ g3N4OP1DIk4UksuubI2Uh75igsY4tdS1/m0xlk00= Received: (qmail 74703 invoked by alias); 4 Jun 2019 08:43:37 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 74695 invoked by uid 89); 4 Jun 2019 08:43:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=average, interval X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 04 Jun 2019 08:43:36 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id BFC03AE84 for ; Tue, 4 Jun 2019 08:43:33 +0000 (UTC) Resent-From: =?utf-8?q?Martin_Li=C5=A1ka?= Resent-To: GCC Patches Resent-Date: Tue, 4 Jun 2019 10:43:33 +0200 Resent-Message-ID: Resent-User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 Message-Id: In-Reply-To: References: From: marxin Date: Thu, 28 Mar 2019 14:07:38 +0100 Subject: [PATCH 3/4] Dump histograms only if present. To: gcc-patches@gcc.gnu.org MIME-Version: 1.0 X-IsSubscribed: yes gcc/ChangeLog: 2019-06-04 Martin Liska * value-prof.c (dump_histogram_value): Print histogram values only if present. --- gcc/value-prof.c | 72 +++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 44 deletions(-) diff --git a/gcc/value-prof.c b/gcc/value-prof.c index e893ca084c9..25b957d0c0a 100644 --- a/gcc/value-prof.c +++ b/gcc/value-prof.c @@ -228,42 +228,38 @@ dump_histogram_value (FILE *dump_file, histogram_value hist) switch (hist->type) { case HIST_TYPE_INTERVAL: - fprintf (dump_file, "Interval counter range %d -- %d", - hist->hdata.intvl.int_start, - (hist->hdata.intvl.int_start - + hist->hdata.intvl.steps - 1)); if (hist->hvalue.counters) { - unsigned int i; - fprintf (dump_file, " ["); - for (i = 0; i < hist->hdata.intvl.steps; i++) - fprintf (dump_file, " %d:%" PRId64, - hist->hdata.intvl.int_start + i, - (int64_t) hist->hvalue.counters[i]); - fprintf (dump_file, " ] outside range:%" PRId64, - (int64_t) hist->hvalue.counters[i]); + fprintf (dump_file, "Interval counter range %d -- %d", + hist->hdata.intvl.int_start, + (hist->hdata.intvl.int_start + + hist->hdata.intvl.steps - 1)); + + unsigned int i; + fprintf (dump_file, " ["); + for (i = 0; i < hist->hdata.intvl.steps; i++) + fprintf (dump_file, " %d:%" PRId64, + hist->hdata.intvl.int_start + i, + (int64_t) hist->hvalue.counters[i]); + fprintf (dump_file, " ] outside range:%" PRId64 ".\n", + (int64_t) hist->hvalue.counters[i]); } - fprintf (dump_file, ".\n"); break; case HIST_TYPE_POW2: - fprintf (dump_file, "Pow2 counter "); if (hist->hvalue.counters) - { - fprintf (dump_file, "pow2:%" PRId64 - " nonpow2:%" PRId64, - (int64_t) hist->hvalue.counters[1], - (int64_t) hist->hvalue.counters[0]); - } - fprintf (dump_file, ".\n"); + fprintf (dump_file, "Pow2 counter pow2:%" PRId64 + " nonpow2:%" PRId64 ".\n", + (int64_t) hist->hvalue.counters[1], + (int64_t) hist->hvalue.counters[0]); break; case HIST_TYPE_SINGLE_VALUE: case HIST_TYPE_INDIR_CALL: - fprintf (dump_file, (hist->type == HIST_TYPE_SINGLE_VALUE - ? "Single values " : "Indirect call ")); if (hist->hvalue.counters) { + fprintf (dump_file, (hist->type == HIST_TYPE_SINGLE_VALUE + ? "Single values " : "Indirect call ")); for (unsigned i = 0; i < GCOV_DISK_SINGLE_VALUES; i++) { fprintf (dump_file, "[%" PRId64 ":%" PRId64 "]", @@ -272,40 +268,28 @@ dump_histogram_value (FILE *dump_file, histogram_value hist) if (i != GCOV_DISK_SINGLE_VALUES - 1) fprintf (dump_file, ", "); } + fprintf (dump_file, ".\n"); } - fprintf (dump_file, ".\n"); break; case HIST_TYPE_AVERAGE: - fprintf (dump_file, "Average value "); if (hist->hvalue.counters) - { - fprintf (dump_file, "sum:%" PRId64 - " times:%" PRId64, - (int64_t) hist->hvalue.counters[0], - (int64_t) hist->hvalue.counters[1]); - } - fprintf (dump_file, ".\n"); + fprintf (dump_file, "Average value sum:%" PRId64 + " times:%" PRId64 ".\n", + (int64_t) hist->hvalue.counters[0], + (int64_t) hist->hvalue.counters[1]); break; case HIST_TYPE_IOR: - fprintf (dump_file, "IOR value "); if (hist->hvalue.counters) - { - fprintf (dump_file, "ior:%" PRId64, - (int64_t) hist->hvalue.counters[0]); - } - fprintf (dump_file, ".\n"); + fprintf (dump_file, "IOR value ior:%" PRId64 ".\n", + (int64_t) hist->hvalue.counters[0]); break; case HIST_TYPE_TIME_PROFILE: - fprintf (dump_file, "Time profile "); if (hist->hvalue.counters) - { - fprintf (dump_file, "time:%" PRId64, - (int64_t) hist->hvalue.counters[0]); - } - fprintf (dump_file, ".\n"); + fprintf (dump_file, "Time profile time:%" PRId64 ".\n", + (int64_t) hist->hvalue.counters[0]); break; case HIST_TYPE_MAX: gcc_unreachable ();