From 0be6fdf972389500ac322f39d4d1bced599b7409 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 19 Dec 2006 21:46:21 +0000 Subject: [PATCH] update to reflect changes in statistic class. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32691 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/ProgrammersManual.html | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/ProgrammersManual.html b/docs/ProgrammersManual.html index 0e1b1376f99..9c885814b14 100644 --- a/docs/ProgrammersManual.html +++ b/docs/ProgrammersManual.html @@ -35,7 +35,7 @@ option and the -debug-only option -
  • The Statistic template & -stats +
  • The Statistic class & -stats option
  • - The Statistic template & -stats + The Statistic class & -stats option
    @@ -493,7 +493,7 @@ even if the source lives in multiple files.

    The "llvm/ADT/Statistic.h" file -provides a template named Statistic that is used as a unified way to +provides a class named Statistic that is used as a unified way to keep track of what the LLVM compiler is doing and how effective various optimizations are. It is useful to see what optimizations are contributing to making a particular program run faster.

    @@ -501,7 +501,7 @@ making a particular program run faster.

    Often you may run your pass on some big program, and you're interested to see how many times it makes a certain transformation. Although you can do this with hand inspection, or some ad-hoc method, this is a real pain and not very useful -for big programs. Using the Statistic template makes it very easy to +for big programs. Using the Statistic class makes it very easy to keep track of this information, and the calculated information is presented in a uniform manner with the rest of the passes being executed.

    @@ -513,13 +513,15 @@ it are as follows:

    -static Statistic<> NumXForms("mypassname", "The # of times I did stuff");
    +#define DEBUG_TYPE "mypassname"   // This goes before any #includes.
    +STATISTIC(NumXForms, "The # of times I did stuff");
     
    -

    The Statistic template can emulate just about any data-type, - but if you do not specify a template argument, it defaults to acting like - an unsigned int counter (this is usually what you want).

    +

    The STATISTIC macro defines a static variable, whose name is + specified by the first argument. The pass name is taken from the DEBUG_TYPE + macro, and the description is taken from the second argument. The variable + defined ("NumXForms" in this case) acts like an unsigned int.

  • Whenever you make a transformation, bump the counter: