OSDN Git Service

Fix no pic
[uclinux-h8/uClinux-dist.git] / user / tpt / massage.c
1 /*
2  * $Header: /cvs/sw/new-wave/user/tpt/massage.c,v 1.1 2002-02-14 23:04:55 pauli Exp $
3  */
4
5 #include <stdio.h>
6 #include <ctype.h>
7
8 #include "tpt.h"
9
10 /*
11  * Convert cycles to nSecs and calculate averages
12  */
13
14 void
15 massage_graph(unsigned long mhz, tpt_node *tpt_list)
16 {
17         tpt_node *node;
18
19         for (node = tpt_list; node; node = node->next)
20         {
21                 int succ_no;
22
23                 for (succ_no = 0; succ_no < node->nr_succs; succ_no++)
24                 {
25                         struct timepeg_arc *arc = &node->succs[succ_no];
26
27                         arc->tot_tp = arc->avg_tp;
28                         arc->tot_tp *= 1000;
29                         arc->tot_tp /= mhz;
30
31                         arc->avg_tp /= arc->nr_times;
32
33                         arc->avg_tp *= 1000;
34                         arc->avg_tp /= mhz;
35
36                         arc->min_tp *= 1000;
37                         arc->min_tp /= mhz;
38
39                         arc->max_tp *= 1000;
40                         arc->max_tp /= mhz;
41
42                 }
43         }
44 }
45
46 static void
47 fix(char *p)
48 {
49         while (*p)
50         {
51                 if (isspace(*p))
52                         *p = '_';
53                 p++;
54         }
55 }
56
57 /*
58  * Overwrite any whitespace in identifiers with "_" so the output of
59  * tpt is easier to sort (with 'sort -n +7', for example).
60  */
61
62 void
63 rename_nodes(tpt_node *tpt_list)
64 {
65         tpt_node *node;
66
67         for (node = tpt_list; node; node = node->next)
68         {
69                 fix(node->name);
70         }
71 }