From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7880) id 5047B385C301; Thu, 16 Feb 2023 16:28:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5047B385C301 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676564896; bh=H4dumZpfKUf0sexBYrrPmwu+k3HCaFCXbWmKzoFhzE0=; h=From:To:Subject:Date:From; b=ScpxOtUKv1QztyldE4f/jOFrY1OPR6PlrlLsu6a6Fn8dP9uxmPphJVnM909B5dgzX Cx2hN0KEmQnQ4k6ztPWrLt3w4K/2rFgutUAK45uwWeZs6TPuS15FZ6EYUDBu2gduJg n9fFt1iUNoYrAJXbFheBseV53Sx5sSpYe/a856VE= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Ondrej Kubanek To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/kubaneko/heads/histogram)] added histogram_counters structure X-Act-Checkin: gcc X-Git-Author: kubaneko X-Git-Refname: refs/users/kubaneko/heads/histogram X-Git-Oldrev: d483867021b5a939c95a1e4da8ac322457ba800f X-Git-Newrev: 22a55f0304297cb9579138efcb7985210f47304a Message-Id: <20230216162816.5047B385C301@sourceware.org> Date: Thu, 16 Feb 2023 16:28:16 +0000 (GMT) List-Id: https://gcc.gnu.org/g:22a55f0304297cb9579138efcb7985210f47304a commit 22a55f0304297cb9579138efcb7985210f47304a Author: kubaneko Date: Tue Nov 8 15:27:20 2022 +0000 added histogram_counters structure Diff: --- gcc/cfgloop.cc | 2 ++ gcc/cfgloop.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++-- gcc/profile.cc | 6 +++++- 3 files changed, 57 insertions(+), 3 deletions(-) diff --git a/gcc/cfgloop.cc b/gcc/cfgloop.cc index 1fdcf2c35e0..6d5929b655a 100644 --- a/gcc/cfgloop.cc +++ b/gcc/cfgloop.cc @@ -1769,6 +1769,8 @@ loop_preheader_edge (const class loop *loop) edge e; edge_iterator ei; + // gcc_assert (loops_state_satisfies_p (LOOPS_HAVE_PREHEADERS) + // && ! loops_state_satisfies_p (LOOPS_MAY_HAVE_MULTIPLE_LATCHES)); FOR_EACH_EDGE (e, ei, loop->header->preds) if (e->src != loop->latch) diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h index a33d59177d0..8df82317c0f 100644 --- a/gcc/cfgloop.h +++ b/gcc/cfgloop.h @@ -92,6 +92,55 @@ struct loop_exit_hasher : ggc_ptr_hash static void remove (loop_exit *); }; +// Information about histogram of the loop from profiling + +struct histogram_counters{ + gcov_type hist[69]; + gcov_type sum; + + // need to think about overflows + // quantil function for the distribution + // returns index under which is koef part of the distribution + int quantil(float koef){ + gcc_assert(0hvalue.lp; if (act_count[t]){ + lp->counters=(histogram_counters*) xcalloc (1, sizeof (histogram_counters)); + gcov_type sum=0; for (int i=0;i<69;++i){ - lp->hist[i]=act_count[t][i]; + lp->counters->hist[i]=act_count[t][i]; + sum+=act_count[t][i]; } + lp->counters->sum=sum; } continue; }