From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7880) id 8C1C83858430; Tue, 22 Nov 2022 13:13:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8C1C83858430 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669122835; bh=zbrsK/v3/JbHAEiQ9Lxu54te0F18EcBy0KzUe0YBzW4=; h=From:To:Subject:Date:From; b=lmq1vWTAgkA8mo6xqgSPvUYSTwVESEK8oocvntyoGyWnxvtB0SnGcei+GH7KAmdME aNtEWb1Z8Obw/ywn9x7nss+636KseAMidsfpACZ517etkzQ7qQL94Lumc8YgzgpHk9 osQMJRXfIs4RWuz8JzY6E+LDAUIyVl3fC3yd+dRk= 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: 2233c2e840936a801cee3c9c8c613edf39c52fdf X-Git-Newrev: 9822a36bab19c14fae1dd4e384b40b179fd1fa06 Message-Id: <20221122131355.8C1C83858430@sourceware.org> Date: Tue, 22 Nov 2022 13:13:55 +0000 (GMT) List-Id: https://gcc.gnu.org/g:9822a36bab19c14fae1dd4e384b40b179fd1fa06 commit 9822a36bab19c14fae1dd4e384b40b179fd1fa06 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; }