#include <stdio.h>
#include <string.h>
#include <malloc.h>
Go to the source code of this file.
◆ NUM_FILES
◆ add_fn()
void add_fn |
( |
int |
fn, |
|
|
char * |
b |
|
) |
| |
Definition at line 23 of file sprof.c.
24{
27 memset(
line_buf[fn],0,1000*
sizeof(
int));
28}
VAR int * line_buf[NUM_FILES]
VAR char * file_names[NUM_FILES]
◆ add_line()
void add_line |
( |
int |
fn, |
|
|
int |
l |
|
) |
| |
Definition at line 13 of file sprof.c.
14{
16 {
20 }
21 else printf(
"overflow: %d\n",
l);
22}
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 73 of file sprof.c.
74{
76 f=fopen(
"smon.out",
"r");
77 if(
f==
NULL) { printf(
"cannot read smon.out\n");
return 2; }
79 {
81 if ((strncmp(
buf,
"STDIN",5)!=0)
82 && (strncmp(
buf,
"(none)",6)!=0)
83 && (strncmp(
buf,
"::",2)!=0))
84 {
85
87 char c;
88 int line_no;
89 while((
buf[
i]!=
':')&&(
i<200))
i++;
92 while ((
buf[
i]!=
' ')&&(
i<200))
i++;
93 sscanf(
buf+
i,
"%d",&line_no);
95 {
97 }
99 {
100 printf(
"new file:%s\n",
buf);
104 }
105 }
106 }
108 printf("----- all read\n");
109 {
112 {
113 printf(
"File %s =============================\n",
file_names[
i]);
115 }
116 }
117 return(0);
118}
void add_line(int fn, int l)
void add_fn(int fn, char *b)
◆ print_line()
Definition at line 30 of file sprof.c.
31{
33 FILE *fo;
35 int ln;
37 {
39 return;
40 }
41 else
42 {
46 }
47 ln=0;
48 while(!feof(fi))
49 {
50 char line[500];
52 s=fgets(line,500,fi);ln++;
55 fprintf(fo,"%4d + %s",ln,line);
56 else
57 fprintf(fo,"%4d %s",ln,line);
58 }
59 fclose(fi);
60 fclose(fo);
62 {
64 {
68 }
69 }
70 printf("\n");
71}
const CanonicalForm int s
◆ buf
◆ file_names
◆ fn_cnt
◆ line_buf