Home | History | Annotate | Download | only in callgrind
      1 /*
      2    This file is part of Callgrind, a Valgrind tool for call graph
      3    profiling programs.
      4 
      5    Copyright (C) 2002-2010, Josef Weidendorfer (Josef.Weidendorfer (at) gmx.de)
      6 
      7    This tool is derived from and contains lot of code from Cachegrind
      8    Copyright (C) 2002 Nicholas Nethercote (njn (at) valgrind.org)
      9 
     10    This program is free software; you can redistribute it and/or
     11    modify it under the terms of the GNU General Public License as
     12    published by the Free Software Foundation; either version 2 of the
     13    License, or (at your option) any later version.
     14 
     15    This program is distributed in the hope that it will be useful, but
     16    WITHOUT ANY WARRANTY; without even the implied warranty of
     17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     18    General Public License for more details.
     19 
     20    You should have received a copy of the GNU General Public License
     21    along with this program; if not, write to the Free Software
     22    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
     23    02111-1307, USA.
     24 
     25    The GNU General Public License is contained in the file COPYING.
     26 */
     27 
     28 #include "config.h" // for VG_PREFIX
     29 
     30 #include "global.h"
     31 
     32 
     33 
     34 /*------------------------------------------------------------*/
     35 /*--- Function specific configuration options              ---*/
     36 /*------------------------------------------------------------*/
     37 
     38 /* Special value for separate_callers: automatic = adaptive */
     39 #define CONFIG_AUTO    -1
     40 
     41 #define CONFIG_DEFAULT -1
     42 #define CONFIG_FALSE    0
     43 #define CONFIG_TRUE     1
     44 
     45 /* Logging configuration for a function */
     46 struct _fn_config {
     47     Int dump_before;
     48     Int dump_after;
     49     Int zero_before;
     50     Int toggle_collect;
     51 
     52     Int skip;    /* Handle CALL to this function as JMP (= Skip)? */
     53     Int group;   /* don't change caller dependency inside group !=0 */
     54     Int pop_on_jump;
     55 
     56     Int separate_callers;    /* separate logging dependent on caller  */
     57     Int separate_recursions; /* separate logging of rec. levels       */
     58 
     59 #if CLG_ENABLE_DEBUG
     60     Int verbosity; /* Change debug verbosity level while in function */
     61 #endif
     62 };
     63 
     64 /* Configurations for function name prefix patterns.
     65  * Currently, only very limit patterns are possible:
     66  * Exact prefix patterns and "*::" are allowed.
     67  * E.g.
     68  *  - "abc" matches all functions starting with "abc".
     69  *  - "abc*::def" matches all functions starting with "abc" and
     70  *    starting with "def" after the first "::" separator.
     71  *  - "*::print(" matches C++ methods "print" in all classes
     72  *    without namespace. I.e. "*" doesn't match a "::".
     73  *
     74  * We build a trie from patterns, and for a given function, we
     75  * go down the tree and apply all non-default configurations.
     76  */
     77 
     78 
     79 #define NODE_DEGREE 30
     80 
     81 /* node of compressed trie search structure */
     82 typedef struct _config_node config_node;
     83 struct _config_node {
     84   Int length;
     85 
     86   fn_config* config;
     87   config_node* sub_node[NODE_DEGREE];
     88   config_node* next;
     89   config_node* wild_star;
     90   config_node* wild_char;
     91 
     92   Char name[1];
     93 };
     94 
     95 /* root of trie */
     96 static config_node* fn_configs = 0;
     97 
     98 static __inline__
     99 fn_config* new_fnc(void)
    100 {
    101    fn_config* fnc = (fn_config*) CLG_MALLOC("cl.clo.nf.1",
    102                                             sizeof(fn_config));
    103 
    104    fnc->dump_before  = CONFIG_DEFAULT;
    105    fnc->dump_after   = CONFIG_DEFAULT;
    106    fnc->zero_before  = CONFIG_DEFAULT;
    107    fnc->toggle_collect = CONFIG_DEFAULT;
    108    fnc->skip         = CONFIG_DEFAULT;
    109    fnc->pop_on_jump  = CONFIG_DEFAULT;
    110    fnc->group        = CONFIG_DEFAULT;
    111    fnc->separate_callers    = CONFIG_DEFAULT;
    112    fnc->separate_recursions = CONFIG_DEFAULT;
    113 
    114 #if CLG_ENABLE_DEBUG
    115    fnc->verbosity    = CONFIG_DEFAULT;
    116 #endif
    117 
    118    return fnc;
    119 }
    120 
    121 
    122 static config_node* new_config(Char* name, int length)
    123 {
    124     int i;
    125     config_node* node = (config_node*) CLG_MALLOC("cl.clo.nc.1",
    126                                                   sizeof(config_node) + length);
    127 
    128     for(i=0;i<length;i++) {
    129       if (name[i] == 0) break;
    130       node->name[i] = name[i];
    131     }
    132     node->name[i] = 0;
    133 
    134     node->length = length;
    135     node->config = 0;
    136     for(i=0;i<NODE_DEGREE;i++)
    137 	node->sub_node[i] = 0;
    138     node->next = 0;
    139     node->wild_char = 0;
    140     node->wild_star = 0;
    141 
    142     CLG_DEBUG(3, "   new_config('%s', len %d)\n", node->name, length);
    143 
    144     return node;
    145 }
    146 
    147 static __inline__
    148 Bool is_wild(Char n)
    149 {
    150   return (n == '*') || (n == '?');
    151 }
    152 
    153 /* Recursively build up function matching tree (prefix tree).
    154  * Returns function config object for pattern <name>
    155  * and starting at tree node <*pnode>.
    156  *
    157  * Tree nodes (config_node) are created as needed,
    158  * tree root is stored into <*pnode>, and the created
    159  * leaf (fn_config) for the given pattern is returned.
    160  */
    161 static fn_config* get_fnc2(config_node* node, Char* name)
    162 {
    163   config_node *new_sub, *n, *nprev;
    164   int offset, len;
    165 
    166   CLG_DEBUG(3, "  get_fnc2(%p, '%s')\n", node, name);
    167 
    168   if (name[0] == 0) {
    169     if (!node->config) node->config = new_fnc();
    170     return node->config;
    171   }
    172 
    173   if (is_wild(*name)) {
    174     if (*name == '*') {
    175       while(name[1] == '*') name++;
    176       new_sub = node->wild_star;
    177     }
    178     else
    179       new_sub = node->wild_char;
    180 
    181     if (!new_sub) {
    182       new_sub = new_config(name, 1);
    183       if (*name == '*')
    184 	node->wild_star = new_sub;
    185       else
    186 	node->wild_char = new_sub;
    187     }
    188 
    189     return get_fnc2( new_sub, name+1);
    190   }
    191 
    192   n = node->sub_node[ name[0]%NODE_DEGREE ];
    193   nprev = 0;
    194   len = 0;
    195   while(n) {
    196     for(len=0; name[len] == n->name[len]; len++);
    197     if (len>0) break;
    198     nprev = n;
    199     n = n->next;
    200   }
    201 
    202   if (!n) {
    203     len = 1;
    204     while(name[len] && (!is_wild(name[len]))) len++;
    205     new_sub = new_config(name, len);
    206     new_sub->next = node->sub_node[ name[0]%NODE_DEGREE ];
    207     node->sub_node[ name[0]%NODE_DEGREE ] = new_sub;
    208 
    209     if (name[len] == 0) {
    210       new_sub->config = new_fnc();
    211       return new_sub->config;
    212     }
    213 
    214     /* recurse on wildcard */
    215     return get_fnc2( new_sub, name+len);
    216   }
    217 
    218   if (len < n->length) {
    219 
    220     /* split up the subnode <n> */
    221     config_node *new_node;
    222     int i;
    223 
    224     new_node = new_config(n->name, len);
    225     if (nprev)
    226       nprev->next = new_node;
    227     else
    228       node->sub_node[ n->name[0]%NODE_DEGREE ] = new_node;
    229     new_node->next = n->next;
    230 
    231     new_node->sub_node[ n->name[len]%NODE_DEGREE ] = n;
    232 
    233     for(i=0, offset=len; offset < n->length; i++, offset++)
    234       n->name[i] = n->name[offset];
    235     n->name[i] = 0;
    236     n->length = i;
    237 
    238     name += len;
    239     offset = 0;
    240     while(name[offset] && (!is_wild(name[offset]))) offset++;
    241     new_sub  = new_config(name, offset);
    242     /* this sub_node of new_node could already be set: chain! */
    243     new_sub->next = new_node->sub_node[ name[0]%NODE_DEGREE ];
    244     new_node->sub_node[ name[0]%NODE_DEGREE ] = new_sub;
    245 
    246     if (name[offset]==0) {
    247       new_sub->config = new_fnc();
    248       return new_sub->config;
    249     }
    250 
    251     /* recurse on wildcard */
    252     return get_fnc2( new_sub, name+offset);
    253   }
    254 
    255   name += n->length;
    256 
    257   if (name[0] == 0) {
    258     /* name and node name are the same */
    259     if (!n->config) n->config = new_fnc();
    260     return n->config;
    261   }
    262 
    263   offset = 1;
    264   while(name[offset] && (!is_wild(name[offset]))) offset++;
    265 
    266   new_sub = new_config(name, offset);
    267   new_sub->next = n->sub_node[ name[0]%NODE_DEGREE ];
    268   n->sub_node[ name[0]%NODE_DEGREE ] = new_sub;
    269 
    270   return get_fnc2(new_sub, name+offset);
    271 }
    272 
    273 static void print_config_node(int depth, int hash, config_node* node)
    274 {
    275   config_node* n;
    276   int i;
    277 
    278   if (node != fn_configs) {
    279     char sp[] = "                                        ";
    280 
    281     if (depth>40) depth=40;
    282     VG_(printf)("%s", sp+40-depth);
    283     if (hash >=0) VG_(printf)(" [hash %2d]", hash);
    284     else if (hash == -2) VG_(printf)(" [wildc ?]");
    285     else if (hash == -3) VG_(printf)(" [wildc *]");
    286     VG_(printf)(" '%s' (len %d)\n", node->name, node->length);
    287   }
    288   for(i=0;i<NODE_DEGREE;i++) {
    289     n = node->sub_node[i];
    290     while(n) {
    291       print_config_node(depth+1, i, n);
    292       n = n->next;
    293     }
    294   }
    295   if (node->wild_char) print_config_node(depth+1, -2, node->wild_char);
    296   if (node->wild_star) print_config_node(depth+1, -3, node->wild_star);
    297 }
    298 
    299 /* get a function config for a name pattern (from command line) */
    300 static fn_config* get_fnc(Char* name)
    301 {
    302   fn_config* fnc;
    303 
    304   CLG_DEBUG(3, " +get_fnc(%s)\n", name);
    305   if (fn_configs == 0)
    306     fn_configs = new_config(name, 0);
    307   fnc =  get_fnc2(fn_configs, name);
    308 
    309   CLG_DEBUGIF(3) {
    310     CLG_DEBUG(3, " -get_fnc(%s):\n", name);
    311     print_config_node(3, -1, fn_configs);
    312   }
    313   return fnc;
    314 }
    315 
    316 
    317 
    318 static void update_fn_config1(fn_node* fn, fn_config* fnc)
    319 {
    320     if (fnc->dump_before != CONFIG_DEFAULT)
    321 	fn->dump_before = (fnc->dump_before == CONFIG_TRUE);
    322 
    323     if (fnc->dump_after != CONFIG_DEFAULT)
    324 	fn->dump_after = (fnc->dump_after == CONFIG_TRUE);
    325 
    326     if (fnc->zero_before != CONFIG_DEFAULT)
    327 	fn->zero_before = (fnc->zero_before == CONFIG_TRUE);
    328 
    329     if (fnc->toggle_collect != CONFIG_DEFAULT)
    330 	fn->toggle_collect = (fnc->toggle_collect == CONFIG_TRUE);
    331 
    332     if (fnc->skip != CONFIG_DEFAULT)
    333 	fn->skip = (fnc->skip == CONFIG_TRUE);
    334 
    335     if (fnc->pop_on_jump != CONFIG_DEFAULT)
    336 	fn->pop_on_jump = (fnc->pop_on_jump == CONFIG_TRUE);
    337 
    338     if (fnc->group != CONFIG_DEFAULT)
    339 	fn->group = fnc->group;
    340 
    341     if (fnc->separate_callers != CONFIG_DEFAULT)
    342 	fn->separate_callers = fnc->separate_callers;
    343 
    344     if (fnc->separate_recursions != CONFIG_DEFAULT)
    345 	fn->separate_recursions = fnc->separate_recursions;
    346 
    347 #if CLG_ENABLE_DEBUG
    348     if (fnc->verbosity != CONFIG_DEFAULT)
    349 	fn->verbosity = fnc->verbosity;
    350 #endif
    351 }
    352 
    353 /* Recursively go down the function matching tree,
    354  * looking for a match to <name>. For every matching leaf,
    355  * <fn> is updated with the pattern config.
    356  */
    357 static void update_fn_config2(fn_node* fn, Char* name, config_node* node)
    358 {
    359     config_node* n;
    360 
    361     CLG_DEBUG(3, "  update_fn_config2('%s', node '%s'): \n",
    362 	     name, node->name);
    363     if ((*name == 0) && node->config) {
    364       CLG_DEBUG(3, "   found!\n");
    365       update_fn_config1(fn, node->config);
    366       return;
    367     }
    368 
    369     n = node->sub_node[ name[0]%NODE_DEGREE ];
    370     while(n) {
    371       if (VG_(strncmp)(name, n->name, n->length)==0) break;
    372       n = n->next;
    373     }
    374     if (n) {
    375 	CLG_DEBUG(3, "   '%s' matching at hash %d\n",
    376 		  n->name, name[0]%NODE_DEGREE);
    377 	update_fn_config2(fn, name+n->length, n);
    378     }
    379 
    380     if (node->wild_char) {
    381 	CLG_DEBUG(3, "   skip '%c' for wildcard '?'\n", *name);
    382 	update_fn_config2(fn, name+1, node->wild_char);
    383     }
    384 
    385     if (node->wild_star) {
    386       CLG_DEBUG(3, "   wildcard '*'\n");
    387       while(*name) {
    388 	update_fn_config2(fn, name, node->wild_star);
    389 	name++;
    390       }
    391       update_fn_config2(fn, name, node->wild_star);
    392     }
    393 }
    394 
    395 /* Update function config according to configs of name prefixes */
    396 void CLG_(update_fn_config)(fn_node* fn)
    397 {
    398     CLG_DEBUG(3, "  update_fn_config('%s')\n", fn->name);
    399     if (fn_configs)
    400       update_fn_config2(fn, fn->name, fn_configs);
    401 }
    402 
    403 
    404 /*--------------------------------------------------------------------*/
    405 /*--- Command line processing                                      ---*/
    406 /*--------------------------------------------------------------------*/
    407 
    408 Bool CLG_(process_cmd_line_option)(Char* arg)
    409 {
    410    Char* tmp_str;
    411 
    412    if      VG_BOOL_CLO(arg, "--skip-plt", CLG_(clo).skip_plt) {}
    413 
    414    else if VG_BOOL_CLO(arg, "--collect-jumps", CLG_(clo).collect_jumps) {}
    415    /* compatibility alias, deprecated option */
    416    else if VG_BOOL_CLO(arg, "--trace-jump",    CLG_(clo).collect_jumps) {}
    417 
    418    else if VG_BOOL_CLO(arg, "--combine-dumps", CLG_(clo).combine_dumps) {}
    419 
    420    else if VG_BOOL_CLO(arg, "--collect-atstart", CLG_(clo).collect_atstart) {}
    421 
    422    else if VG_BOOL_CLO(arg, "--instr-atstart", CLG_(clo).instrument_atstart) {}
    423 
    424    else if VG_BOOL_CLO(arg, "--separate-threads", CLG_(clo).separate_threads) {}
    425 
    426    else if VG_BOOL_CLO(arg, "--compress-strings", CLG_(clo).compress_strings) {}
    427    else if VG_BOOL_CLO(arg, "--compress-mangled", CLG_(clo).compress_mangled) {}
    428    else if VG_BOOL_CLO(arg, "--compress-pos",     CLG_(clo).compress_pos) {}
    429 
    430    else if VG_STR_CLO(arg, "--fn-skip", tmp_str) {
    431        fn_config* fnc = get_fnc(tmp_str);
    432        fnc->skip = CONFIG_TRUE;
    433    }
    434 
    435    else if VG_STR_CLO(arg, "--dump-before", tmp_str) {
    436        fn_config* fnc = get_fnc(tmp_str);
    437        fnc->dump_before = CONFIG_TRUE;
    438    }
    439 
    440    else if VG_STR_CLO(arg, "--zero-before", tmp_str) {
    441        fn_config* fnc = get_fnc(tmp_str);
    442        fnc->zero_before = CONFIG_TRUE;
    443    }
    444 
    445    else if VG_STR_CLO(arg, "--dump-after", tmp_str) {
    446        fn_config* fnc = get_fnc(tmp_str);
    447        fnc->dump_after = CONFIG_TRUE;
    448    }
    449 
    450    else if VG_STR_CLO(arg, "--toggle-collect", tmp_str) {
    451        fn_config* fnc = get_fnc(tmp_str);
    452        fnc->toggle_collect = CONFIG_TRUE;
    453        /* defaults to initial collection off */
    454        CLG_(clo).collect_atstart = False;
    455    }
    456 
    457    else if VG_INT_CLO(arg, "--separate-recs", CLG_(clo).separate_recursions) {}
    458 
    459    /* change handling of a jump between functions to ret+call */
    460    else if VG_XACT_CLO(arg, "--pop-on-jump", CLG_(clo).pop_on_jump, True) {}
    461    else if VG_STR_CLO( arg, "--pop-on-jump", tmp_str) {
    462        fn_config* fnc = get_fnc(tmp_str);
    463        fnc->pop_on_jump = CONFIG_TRUE;
    464    }
    465 
    466 #if CLG_ENABLE_DEBUG
    467    else if VG_INT_CLO(arg, "--ct-verbose", CLG_(clo).verbose) {}
    468    else if VG_INT_CLO(arg, "--ct-vstart",  CLG_(clo).verbose_start) {}
    469 
    470    else if VG_STREQN(12, arg, "--ct-verbose") {
    471        fn_config* fnc;
    472        Char* s;
    473        UInt n = VG_(strtoll10)(arg+12, &s);
    474        if ((n <= 0) || *s != '=') return False;
    475        fnc = get_fnc(s+1);
    476        fnc->verbosity = n;
    477    }
    478 #endif
    479 
    480    else if VG_XACT_CLO(arg, "--separate-callers=auto",
    481                             CLG_(clo).separate_callers, CONFIG_AUTO) {}
    482    else if VG_INT_CLO( arg, "--separate-callers",
    483                             CLG_(clo).separate_callers) {}
    484 
    485    else if VG_STREQN(10, arg, "--fn-group") {
    486        fn_config* fnc;
    487        Char* s;
    488        UInt n = VG_(strtoll10)(arg+10, &s);
    489        if ((n <= 0) || *s != '=') return False;
    490        fnc = get_fnc(s+1);
    491        fnc->group = n;
    492    }
    493 
    494    else if VG_STREQN(18, arg, "--separate-callers") {
    495        fn_config* fnc;
    496        Char* s;
    497        UInt n = VG_(strtoll10)(arg+18, &s);
    498        if ((n <= 0) || *s != '=') return False;
    499        fnc = get_fnc(s+1);
    500        fnc->separate_callers = n;
    501    }
    502 
    503    else if VG_STREQN(15, arg, "--separate-recs") {
    504        fn_config* fnc;
    505        Char* s;
    506        UInt n = VG_(strtoll10)(arg+15, &s);
    507        if ((n <= 0) || *s != '=') return False;
    508        fnc = get_fnc(s+1);
    509        fnc->separate_recursions = n;
    510    }
    511 
    512    else if VG_STR_CLO(arg, "--callgrind-out-file", CLG_(clo).out_format) {}
    513 
    514    else if VG_BOOL_CLO(arg, "--mangle-names", CLG_(clo).mangle_names) {}
    515 
    516    else if VG_BOOL_CLO(arg, "--skip-direct-rec",
    517                             CLG_(clo).skip_direct_recursion) {}
    518 
    519    else if VG_BOOL_CLO(arg, "--dump-bbs",   CLG_(clo).dump_bbs) {}
    520    else if VG_BOOL_CLO(arg, "--dump-line",  CLG_(clo).dump_line) {}
    521    else if VG_BOOL_CLO(arg, "--dump-instr", CLG_(clo).dump_instr) {}
    522    else if VG_BOOL_CLO(arg, "--dump-bb",    CLG_(clo).dump_bb) {}
    523 
    524    else if VG_INT_CLO( arg, "--dump-every-bb", CLG_(clo).dump_every_bb) {}
    525 
    526    else if VG_BOOL_CLO(arg, "--collect-alloc",   CLG_(clo).collect_alloc) {}
    527    else if VG_BOOL_CLO(arg, "--collect-systime", CLG_(clo).collect_systime) {}
    528    else if VG_BOOL_CLO(arg, "--collect-bus",     CLG_(clo).collect_bus) {}
    529    /* for option compatibility with cachegrind */
    530    else if VG_BOOL_CLO(arg, "--cache-sim",       CLG_(clo).simulate_cache) {}
    531    /* compatibility alias, deprecated option */
    532    else if VG_BOOL_CLO(arg, "--simulate-cache",  CLG_(clo).simulate_cache) {}
    533    /* for option compatibility with cachegrind */
    534    else if VG_BOOL_CLO(arg, "--branch-sim",      CLG_(clo).simulate_branch) {}
    535    else {
    536        Bool isCachesimOption = (*CLG_(cachesim).parse_opt)(arg);
    537 
    538        /* cache simulator is used if a simulator option is given */
    539        if (isCachesimOption)
    540 	   CLG_(clo).simulate_cache = True;
    541 
    542        return isCachesimOption;
    543    }
    544 
    545    return True;
    546 }
    547 
    548 void CLG_(print_usage)(void)
    549 {
    550    VG_(printf)(
    551 "\n   dump creation options:\n"
    552 "    --callgrind-out-file=<f>  Output file name [callgrind.out.%%p]\n"
    553 "    --dump-line=no|yes        Dump source lines of costs? [yes]\n"
    554 "    --dump-instr=no|yes       Dump instruction address of costs? [no]\n"
    555 "    --compress-strings=no|yes Compress strings in profile dump? [yes]\n"
    556 "    --compress-pos=no|yes     Compress positions in profile dump? [yes]\n"
    557 "    --combine-dumps=no|yes    Concat all dumps into same file [no]\n"
    558 #if CLG_EXPERIMENTAL
    559 "    --compress-events=no|yes  Compress events in profile dump? [no]\n"
    560 "    --dump-bb=no|yes          Dump basic block address of costs? [no]\n"
    561 "    --dump-bbs=no|yes         Dump basic block info? [no]\n"
    562 "    --dump-skipped=no|yes     Dump info on skipped functions in calls? [no]\n"
    563 "    --mangle-names=no|yes     Mangle separation into names? [yes]\n"
    564 #endif
    565 
    566 "\n   activity options (for interactivity use callgrind_control):\n"
    567 "    --dump-every-bb=<count>   Dump every <count> basic blocks [0=never]\n"
    568 "    --dump-before=<func>      Dump when entering function\n"
    569 "    --zero-before=<func>      Zero all costs when entering function\n"
    570 "    --dump-after=<func>       Dump when leaving function\n"
    571 #if CLG_EXPERIMENTAL
    572 "    --dump-objs=no|yes        Dump static object information [no]\n"
    573 #endif
    574 
    575 "\n   data collection options:\n"
    576 "    --instr-atstart=no|yes    Do instrumentation at callgrind start [yes]\n"
    577 "    --collect-atstart=no|yes  Collect at process/thread start [yes]\n"
    578 "    --toggle-collect=<func>   Toggle collection on enter/leave function\n"
    579 "    --collect-jumps=no|yes    Collect jumps? [no]\n"
    580 "    --collect-bus=no|yes      Collect global bus events? [no]\n"
    581 #if CLG_EXPERIMENTAL
    582 "    --collect-alloc=no|yes    Collect memory allocation info? [no]\n"
    583 #endif
    584 "    --collect-systime=no|yes  Collect system call time info? [no]\n"
    585 
    586 "\n   cost entity separation options:\n"
    587 "    --separate-threads=no|yes Separate data per thread [no]\n"
    588 "    --separate-callers=<n>    Separate functions by call chain length [0]\n"
    589 "    --separate-callers<n>=<f> Separate <n> callers for function <f>\n"
    590 "    --separate-recs=<n>       Separate function recursions up to level [2]\n"
    591 "    --separate-recs<n>=<f>    Separate <n> recursions for function <f>\n"
    592 "    --skip-plt=no|yes         Ignore calls to/from PLT sections? [yes]\n"
    593 "    --skip-direct-rec=no|yes  Ignore direct recursions? [yes]\n"
    594 "    --fn-skip=<function>      Ignore calls to/from function?\n"
    595 #if CLG_EXPERIMENTAL
    596 "    --fn-group<no>=<func>     Put function into separation group <no>\n"
    597 #endif
    598 "\n   simulation options:\n"
    599 "    --branch-sim=no|yes       Do branch prediction simulation [no]\n"
    600 "    --cache-sim=no|yes        Do cache simulation [no]\n"
    601     );
    602 
    603    (*CLG_(cachesim).print_opts)();
    604 
    605 //   VG_(printf)("\n"
    606 //	       "  For full callgrind documentation, see\n"
    607 //	       "  "VG_PREFIX"/share/doc/callgrind/html/callgrind.html\n\n");
    608 }
    609 
    610 void CLG_(print_debug_usage)(void)
    611 {
    612     VG_(printf)(
    613 
    614 #if CLG_ENABLE_DEBUG
    615 "    --ct-verbose=<level>       Verbosity of standard debug output [0]\n"
    616 "    --ct-vstart=<BB number>    Only be verbose after basic block [0]\n"
    617 "    --ct-verbose<level>=<func> Verbosity while in <func>\n"
    618 #else
    619 "    (none)\n"
    620 #endif
    621 
    622     );
    623 }
    624 
    625 
    626 void CLG_(set_clo_defaults)(void)
    627 {
    628   /* Default values for command line arguments */
    629 
    630   /* dump options */
    631   CLG_(clo).out_format       = 0;
    632   CLG_(clo).combine_dumps    = False;
    633   CLG_(clo).compress_strings = True;
    634   CLG_(clo).compress_mangled = False;
    635   CLG_(clo).compress_events  = False;
    636   CLG_(clo).compress_pos     = True;
    637   CLG_(clo).mangle_names     = True;
    638   CLG_(clo).dump_line        = True;
    639   CLG_(clo).dump_instr       = False;
    640   CLG_(clo).dump_bb          = False;
    641   CLG_(clo).dump_bbs         = False;
    642 
    643   CLG_(clo).dump_every_bb    = 0;
    644 
    645   /* Collection */
    646   CLG_(clo).separate_threads = False;
    647   CLG_(clo).collect_atstart  = True;
    648   CLG_(clo).collect_jumps    = False;
    649   CLG_(clo).collect_alloc    = False;
    650   CLG_(clo).collect_systime  = False;
    651   CLG_(clo).collect_bus      = False;
    652 
    653   CLG_(clo).skip_plt         = True;
    654   CLG_(clo).separate_callers = 0;
    655   CLG_(clo).separate_recursions = 2;
    656   CLG_(clo).skip_direct_recursion = False;
    657 
    658   /* Instrumentation */
    659   CLG_(clo).instrument_atstart = True;
    660   CLG_(clo).simulate_cache = False;
    661   CLG_(clo).simulate_branch = False;
    662 
    663   /* Call graph */
    664   CLG_(clo).pop_on_jump = False;
    665 
    666 #if CLG_ENABLE_DEBUG
    667   CLG_(clo).verbose = 0;
    668   CLG_(clo).verbose_start = 0;
    669 #endif
    670 }
    671