Wie zähle ich die Anzahl der Zyklen (Anzahl) und Anweisungen (Simticks) eines Code, der Simulation mit GEM5 macht?Linux

Linux verstehen
Anonymous
 Wie zähle ich die Anzahl der Zyklen (Anzahl) und Anweisungen (Simticks) eines Code, der Simulation mit GEM5 macht?

Post by Anonymous »

Ich bin neu auf GEM5. ist, die Anzahl der Anweisungen und Zyklen zu erhalten, die ein Teil dieses Programms (ein Bubble -Sortiercode) zum Ausführen benötigt. Parameter, aber diese Datei bezieht sich auf die gesamte Programmausführung. Ich brauche die Simticks und Anzahl der Blasensortierfunktion. < /P>
Gibt es eine Möglichkeit, dies zu tun? Benötigen Sie immer genauere Daten. < /p>
Vielen Dank im Voraus.

Code: Select all

#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;
}

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post