Скачиваний:
21
Добавлен:
01.05.2014
Размер:
103.42 Кб
Скачать
  1. Выполнение профилирования программ на с (из 1 лабораторной работы).

  1. В c

  1. Профилирование по затрачиваемому времени и количеству выполнения каждой строки (с зацикливанием ).

Turbo Profiler Version 2.1 Tue Mar 30 13:50:13 2004

Program: D:\BORLANDC\BIN\LAB.EXE File METROL~1\LAB.CPP

Time Counts

#include <iostream.h>

#include <conio.h>

#define rmax 5

#define cmax 5

typedef float ary[ rmax ];

typedef float arys[ cmax ];

typedef float ary2[ rmax ][ cmax ];

typedef float ary2s[ cmax ][ cmax ];

ary y;

arys g;

ary2 x;

ary2s a;

int nrow,ncol;

0.0000 1 void get_data( ary2 x, ary y, int &nrow, int &ncol)

// get the values for nrow, ncol, and arrays x,y

{

int i,j,s;

0.0000 1 nrow = 2; // this value can be chaged

0.0000 1 ncol = 2;

0.0000 1 for ( i = 0; i < nrow ; i++)

{

0.0000 2 x[i][0] = 1;

0.0000 2 for ( j = 1; j < ncol ; j++)

0.0000 2 x[i][j] = i * x[i][j-1];

0.0000 2 s = i+1;

0.0000 2 y[i] = 2 * s;

}

0.0000 1 } // procedure get_data

0.0000 1 void write_data()

// print out the answeres

{

int i,j;

// clrscr();

/* cout <<"\n";

cout <<"\n X Y\n\n\n";*/

0.0000 1 for ( i = 0; i < nrow ; i++)

{

0.0000 2 for ( j = 0; j < ncol ; j++)

{}

/* cout <<x[i][j] <<" ";

cout <<": "<<y[i] <<"\n\n\n";*/

}

Turbo Profiler Version 2.1 Tue Mar 30 13:50:13 2004

/* cout <<"\n\n A G\n\n\n";*/

0.0000 1 for ( i = 0; i < ncol ; i++)

{

0.0000 2 for ( j = 0; j < ncol ; j++)

{ }

/* cout << a[i][j]<<" ";

cout <<": " << g[i] <<"\n\n\n";*/

}

0.0000 1 }// write_data

{SUITE DE CETTE PARTIE}

0.0000 1 void square(ary2 x,

ary y,

ary2s a,

arys g,

int nrow,

int ncol)

//matrix multiplication routine

// a= transpose x times x

// g= y times x

{

int i,k,l;

// square

0.0000 1 for ( k = 0; k < ncol ; k++)

{

0.0000 2 for ( l = 0; l < k ; l++)

{

0.0000 1 a[k][l] = 0;

0.0000 1 for ( i = 0; i < nrow ; i++)

{

0.0000 2 a[k][l] = a[k][l] + x[i][l] * x[i][k];

0.0000 2 if (k != l) a[l][k] = a[k][l];

}

} // l-loop

0.0000 2 g[k] = 0;

0.0000 2 for ( i = 0; i < nrow ; i++)

{

0.0000 4 g[k] = g[k] + y[i] * x[i][k];

}

} // k-loop

0.0000 1 } // square

void main()

{

0.0000 1 get_data(x,y,nrow,ncol);

0.0000 1 square(x,y,a,g,nrow,ncol);

0.0000 1 write_data();

// getch();

0.0009 1 }

Turbo Profiler Version 2.1 Tue Mar 30 13:50:34 2004

Program: D:\BORLANDC\BIN\LAB.EXE

Execution Profile

Total time: 0.0027 sec

% of total: 35 %

Run: 1 of 1

Filter: All

Show: Time

Sort: Frequency

#LAB#116 0.0009 sec 95% |**********************************************

#LAB#104 0.0000 sec <1% |

#LAB#96 0.0000 sec <1% |

#LAB#90 0.0000 sec <1% |

#LAB#31 0.0000 sec <1% |

#LAB#32 0.0000 sec <1% |

#LAB#33 0.0000 sec <1% |

#LAB#34 0.0000 sec <1% |

#LAB#35 0.0000 sec <1% |

#LAB#102 0.0000 sec <1% |

#LAB#100 0.0000 sec <1% |

#LAB#112 0.0000 sec <1% |

#LAB#53 0.0000 sec <1% |

#LAB#95 0.0000 sec <1% |

#LAB#113 0.0000 sec <1% |

#LAB#64 0.0000 sec <1% |

get_data 0.0000 sec <1% |

#LAB#88 0.0000 sec <1% |

square 0.0000 sec <1% |

#LAB#92 0.0000 sec <1% |

#LAB#93 0.0000 sec <1% |

#LAB#62 0.0000 sec <1% |

#LAB#51 0.0000 sec <1% |

write_data 0.0000 sec <1% |

#LAB#37 0.0000 sec <1% |

#LAB#29 0.0000 sec <1% |

#LAB#107 0.0000 sec <1% |

#LAB#27 0.0000 sec <1% |

#LAB#114 0.0000 sec <1% |

#LAB#26 0.0000 sec <1% |

#LAB#70 0.0000 sec <1% |

Turbo Profiler Version 2.1 Tue Mar 30 13:49:15 2004

Program: D:\BORLANDC\BIN\LAB.EXE

Execution Profile

Total time: 0.0028 sec

% of total: 37 %

Run: 1 of 1

Filter: All

Show: Time per call

Sort: Frequency

#LAB#116 0.0009 sec/call |**********************************************

#LAB#95 0.0000 sec/call |

#LAB#113 0.0000 sec/call |

#LAB#112 0.0000 sec/call |

get_data 0.0000 sec/call |

#LAB#32 0.0000 sec/call |

#LAB#33 0.0000 sec/call |

#LAB#34 0.0000 sec/call |

#LAB#35 0.0000 sec/call |

#LAB#37 0.0000 sec/call |

write_data 0.0000 sec/call |

#LAB#51 0.0000 sec/call |

#LAB#53 0.0000 sec/call |

#LAB#62 0.0000 sec/call |

#LAB#64 0.0000 sec/call |

#LAB#31 0.0000 sec/call |

square 0.0000 sec/call |

#LAB#88 0.0000 sec/call |

#LAB#90 0.0000 sec/call |

#LAB#92 0.0000 sec/call |

#LAB#93 0.0000 sec/call |

#LAB#29 0.0000 sec/call |

#LAB#96 0.0000 sec/call |

#LAB#100 0.0000 sec/call |

#LAB#102 0.0000 sec/call |

#LAB#104 0.0000 sec/call |

#LAB#107 0.0000 sec/call |

#LAB#27 0.0000 sec/call |

#LAB#114 0.0000 sec/call |

#LAB#26 0.0000 sec/call |

#LAB#70 0.0000 sec/call |

7

Соседние файлы в папке Sissy_Metr