From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7880) id 79FAC385B50D; Thu, 23 Feb 2023 23:22:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 79FAC385B50D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677194527; bh=B8wCt2sEV9qsJceGm3wiFlKbOg0+bmizrf6rOkK0wl4=; h=From:To:Subject:Date:From; b=PklDzqT8VmyWoEzNa70tssFD3wMOkPPS7pui8AHlTmgrtTFJ4DJue2kqjH98TYdEQ jH85/RwxoDnySeYWWr93WhTfloSHJ/jqUuH+IkQspt8zZhRbFEiHb8+7RHigo0jRcU HcJ38CDSxwT61aN7P4nEdEsK84kNhDRbsDNYEyHs= 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: ef357765f596c358b223b7374f4a1574b7483a64 X-Git-Newrev: 1aa8abc66731f6256653ef54607eb0b759ce1467 Message-Id: <20230223232207.79FAC385B50D@sourceware.org> Date: Thu, 23 Feb 2023 23:22:07 +0000 (GMT) List-Id: https://gcc.gnu.org/g:1aa8abc66731f6256653ef54607eb0b759ce1467 commit 1aa8abc66731f6256653ef54607eb0b759ce1467 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 8523c11fe95..201893f1624 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 63c75e8a0de..7b9a854f266 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; }