Vorher:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls us/call us/call name
100.16 0.01 0.01 6268 1.60 1.60 __join_together
100,16% der Zeit verbringt das Programm mit __join_together
1 static char *__join_together(char *a, char *b, int len_b) 2 { 3 int len = len_b+1; 4 int len_a = 0; 5 int i; 6 char *txt; 7 8 if (a != NULL) 9 len_a = strlen(a); 10 11 len += len_a; 12 13 txt = malloc(sizeof(char)*len); 14 15 for (i = 0; i < len_a; i++) 16 txt[i] = a[i]; 17 18 for (i = 0; i < len_b; i++) 19 txt[i+len_a] = b[i]; 20 21 txt[len-1] = '\0'; 22 23 if (a != NULL) 24 free(a); 25 26 return txt; 27 }
Nacher:
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
0.00 0.00 0.00 6598 0.00 0.00 __join_together
0% der Zeit wird fuer __join_together benoetigt (naja, gerundet ...)
1 static char *__join_together(char *a, char *b, int len_b) 2 { 3 int len_a = 0; 4 int i; 5 char *new; 6 7 if (a != NULL) 8 len_a += strlen(a); 9 10 new = realloc(a, len_b+1+len_a); 11 12 if (new != NULL) 13 for (i = 0; i < len_b; i++) 14 new[i+len_a] = b[i]; 15 16 17 new[len_a+len_b] = '\0'; 18 19 return new; 20 }

