Skip to content

Commit

Permalink
Update main.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Amit-P89 authored Jun 28, 2024
1 parent 5b9a29e commit 94eebe9
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions DRACKSim-Detailed/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ using namespace std;
#include <sstream>
#include <fstream>
#define local_remote 1
#define MEM_LOG 1

uint64_t common_clock = 0;
ofstream out,mem_stats,invalid,netstats;
#include "mem_defs.cpp"
Expand Down Expand Up @@ -43,7 +45,7 @@ ofstream inst_queu_out;

#define Result_cycle 50000000

#define max_insts_to_simulate 50000000
long int max_insts_to_simulate = 1000000;


void print_stats(int);
Expand Down Expand Up @@ -201,8 +203,7 @@ void *node_stream_handler(void *node)
for(int j=0;j<core_count;j++)
{
node_num_inst_issued+=num_inst_issued[nodeid][j];
}

}

pthread_mutex_lock(&lock);

Expand Down Expand Up @@ -259,26 +260,28 @@ void *node_stream_handler(void *node)
common_clock++;
}

static int i=0;
static int counter=0;
combined_count = 0;
for (int i = 0; i < core_count; i++)
{
combined_count += core_inst_stream[nodeid][i].size();
if(inst_queue[nodeid][i].size())// || !reorder_buffer[nodeid][i].is_empty())
core_simulated_cycle[nodeid][i]++;
}

//some weird logic to close the program when the workload exits.
if(combined_count==0)
{
i++;
if(i==2000)
counter++;
if(counter==2000)
{
cout<<"ooo";
break;
}
}
else if(combined_count>0)
{
i=0;
counter=0;
}

total_num_inst_commited=0;
Expand Down Expand Up @@ -494,9 +497,11 @@ void print_stats(int node_id)
ResultsFile[node_id] << "\nTotal Issued instructions: \t\t\t\t\t" << total_num_inst_issued;
ResultsFile[node_id] << "\nTotal executed instructions: \t\t\t\t\t" << total_num_inst_exec;
ResultsFile[node_id] << "\nTotal committed instructions: \t\t\t\t\t" <<total_num_inst_commited;
float IPC=0;
double IPC=0;
for(int i=0;i<core_count;i++)
{
IPC=IPC+IPCC[i];
}
ResultsFile[node_id] << "\nIPC is: \t\t\t\t\t\t\t" << IPC;
ResultsFile[node_id] << "\nCPI is: \t\t\t\t\t\t\t" << 1/IPC;
ResultsFile[node_id] << "\nL3 cache demand accesses: \t\t\t\t\t" << num_l3_access[node_id];
Expand Down Expand Up @@ -577,11 +582,20 @@ int main(int argc, char *argv[])
}
if(argc<2)
{
cout<<"\nEnter output directory name for results\n";
cout<<"\n1. Enter output directory name for results as first argument \n";
cout<<"\n2. Optionally, mention the number of instructions to simulate as second argument (default is 1million)\n";
exit(0);
}
else if(argc==2)
{
dir=argv[1];
cout<<"\nInstructions to simulate set default to 1-million\n";
}
else if(argc==3)
{
dir=argv[1];
max_insts_to_simulate = atoi(argv[2]);
}

cout<<"\nEnter starting node number:";
cin>>nid;
Expand Down

0 comments on commit 94eebe9

Please sign in to comment.