Я новичок на GEM5. < /p>
Я использую простейшую архитектурную модель с TimingsImplecpu для запуска небольшой программы. < /p>
Моя цель заключается в том, чтобы получить количество инструкций и циклов, которые требуется часть этой программы (код сортировки пузырьков). Параметры, но этот файл связан со всем выполнением программы. Мне нужны Simticks и Numcycles только функции сортировки пузырьков. < /P>
Есть ли способ сделать это? Нужны все более и более точные данные. < /p>
#include
#include
#include
struct timespec start, end;
int arr[20] = {796, 665, 845, 523, 122, 332, 168, 337, 553, 121, 487, 449, 790, 806, 175, 81, 142, 939, 564, 656};
int size = 20;
int bsort_BubbleSort( int *arr, int bsort_SIZE )
{
int Sorted = 0;
int Temp, Index, i;
for ( i = 0; i < bsort_SIZE - 1; i ++ ) {
Sorted = 1;
for ( Index = 0; Index < bsort_SIZE - 1; Index ++ ) {
if ( Index > bsort_SIZE - i )
break;
if ( arr[ Index ] > arr[Index + 1] ) {
Temp = arr[ Index ];
arr[ Index ] = arr[ Index + 1 ];
arr[ Index + 1 ] = Temp;
Sorted = 0;
}
}
if ( Sorted )
break;
}
return 0;
}
int main() {
clock_t t1, t2;
int i;
float diff;
int array[size];
FILE * pFile;
pFile = fopen ("myfile.txt","w");
t1 = clock();
bsort_BubbleSort(array, size); //need simTicks and numCycles of this fragment
t2 = clock();
diff = (((float)t2 - (float)t1) / 1000000.0F );
fprintf (pFile, "%f\n", diff);
fclose(pFile);
return 0;
}
Подробнее здесь: https://stackoverflow.com/questions/794 ... cks-of-a-p
Как подсчитать количество циклов (Numcycles) и инструкций (simticks) куска кода, выполняющего моделирование с GEM5? ⇐ Linux
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение