Exemplo n.º 1
0
int plugin_init (struct plugin_name_args *plugin_info,
                 struct plugin_gcc_version *version)
{
    // default
    trace_call_type = PRINTF;

    if (plugin_info->argc > 0)
    {
        int i;
        for (i = 0; i < plugin_info->argc; i++)
        {
            if (strcmp(plugin_info->argv[i].key, "calltype") == 0)
            {
                if (strcmp(plugin_info->argv[i].value, "callback") == 0)
                    trace_call_type = CALLBACK;
            }
            if (strcmp(plugin_info->argv[i].key, "tracefile") == 0)
            {
                read_trace_file(plugin_info->argv[i].value);
            }
        }
    }

    printf("\nAnalyzing branches..\n");

    // Note: PLUGIN_PRE_GENERICIZE has more options for traversing modifying
    // and will call handle_pre_generic for each function
    register_callback (plugin_info->base_name,
                       PLUGIN_PRE_GENERICIZE, &handle_pre_generic, NULL);

    return 0;
}
Exemplo n.º 2
0
void process3 (char* infile, char* outfile1, char* outfile2, int _range)
{
	// Read the input file
	read_trace_file (infile);

	range = _range;
	wl1_dels = 0;
	wl2_dels = 0;
	il = 0;

	// Make the map of the input file
	cout << "Creating map ... ";
	build_sector_map();
	cout << "done" << endl;

	// Figure out how many in wl1 and how many in wl2
	cout << "Processing workload ...";
	process_dels();
	cout << "done" << endl;
	cout << "WL1_dels: " << wl1_dels << "\tWL2_dels: " << wl2_dels << endl;

	// Write out the output files
	cout << "Writing output files ...";
	write_trace_file (outfile1, outfile2);
	cout << "done" << endl;

	//-----------------------------------------------------------------------
	//------------ CLean up -------------------------------------------------
	//-----------------------------------------------------------------------
	clean_up();
	delete[] dela;
	delete[] sectori;
}
Exemplo n.º 3
0
void simulator_main(int argc, char** argv) 
{
  init_knobs(argc, argv);

  // trace driven simulation 
  read_trace_file();
  init_structures();
  run_a_cycle();

}
Exemplo n.º 4
0
void simulator_main(int argc, char** argv) 
{
  init_knobs(argc, argv);

  // trace driven simulation 
  read_trace_file();
   /** NEW-LAB2 */ /* just note: passing main memory pointers is hack to mix up c++ objects and c-style code */  /* Not recommended at all */ 
  memory_c *main_memory = new memory_c();  // /** NEW-LAB2 */ 


  init_structures(main_memory);  // please modify run_a_cycle function argument  /** NEW-LAB2 */ 
  run_a_cycle(main_memory); // please modify run_a_cycle function argument  /** NEW-LAB2 */ 

}
Exemplo n.º 5
0
void simulator_main(int argc, char** argv) 
{
  init_knobs(argc, argv);

  // trace driven simulation 
  read_trace_file();

  /** NEW-LAB2 */ /* just note: passing main memory pointers is hack to mix up c++ objects and c-style code */  /* Not recommended at all */ 
  memory_c *main_memory = new memory_c();  // /** NEW-LAB2 */ 


  init_structures(main_memory);  // please modify run_a_cycle function argument  /** NEW-LAB2 */ 
  
  /*LAB 3*/
  if(KNOB(KNOB_USE_BPRED)->getValue())
  {
	  use_bpred=true;
	  bpred_type type=(bpred_type) KNOB(KNOB_BPRED_TYPE)->getValue();
	  unsigned int bhr_len;
	  if(type == BPRED_TAKEN || type == BPRED_NOTTAKEN || type == BPRED_BIMODAL)
		  bhr_len=0;
	  else if(type == BPRED_GSHARE)
		  bhr_len=KNOB(KNOB_BPRED_HIST_LEN)->getValue();
	  branchpred=bpred_new(type,bhr_len);
  }
  /*LAB 3*/
  if(KNOB(KNOB_ENABLE_VMEM)->getValue())
  {
	  vmem_enabled=true;
	  dtlb = tlb_new(KNOB(KNOB_TLB_ENTRIES)->getValue());
	  vmem_page_size=KNOB(KNOB_VMEM_PAGE_SIZE)->getValue();
  }
  run_a_cycle(main_memory); // please modify run_a_cycle function argument  /** NEW-LAB2 */ 


}
Exemplo n.º 6
0
void Parser::read_trace() {
  read_trace_file(traceFile);
}
Exemplo n.º 7
0
void process2 (char* infile, char* outfile1, char* outfile2, int range)
{
	//-----------------------------------------------------------------------
	//----------- Read the input workload into memory -----------------------
	//-----------------------------------------------------------------------
	read_trace_file (infile);

	//-----------------------------------------------------------------------
	// ---------- Separate the workload -------------------------------------
	//-----------------------------------------------------------------------
	cout << "Splitting Workload ... ";

	splitWorkload2(range);

	cout << "done" << endl;

	//-----------------------------------------------------------------------
	// Find how many delete operations were added to Workload 1
	//-----------------------------------------------------------------------
	int wl1_dels = 0;
	for (int i=0; i<l; i++)
	{
		if ( indices[i] < -1 )
		{
			int prev_index = -indices[i] - 1;
			if ( isWL1(prev_index) )
			{
				wl1_dels++;
			}
		}
	}

	//-----------------------------------------------------------------------
	// ---------- Output the workload to two separate files  ----------------
	//-----------------------------------------------------------------------
	cout << "Writing Split Workloads ... ";

	/*ofstream ofile1(outfile1), ofile2(outfile2);

	// Write out the headers for both the files
	ofile1 << "TRACE2TI" << endl;
	ofile2 << "TRACE2TI" << endl;
	ofile1 << m << endl;
	ofile2 << m << endl;
	ofile1 << il << endl;
	ofile2 << (l - il) << endl;
	ofile1 << endl;
	ofile2 << endl;

	// Write out the contents of the files
	for (int i=0; i<l; i++)
	{
		if ( isWL1(i) )
		{
			ofile1 << 1 << '\t' << sector[i] << '\t' << ti[i] << endl;
		}
		else
		{
			//ofile2 << sector[i] << '\t' << ti[i] << endl;
			ofile2 << 1 << '\t' << sector[i] << endl;
		}
	}

	ofile1.close();
	ofile2.close();*/

	// Output the files with the C implementation (hoping it's faster)
	FILE* of1 = fopen(outfile1, "w+");
	FILE* of2 = fopen(outfile2, "w+");

	fprintf (of1, "%s\n%d\n%d\n%d\n\n", "TRACE2TI", m, il+wl1_dels, il);
	fprintf (of2, "%s\n%d\n%d\n\n", "TRACE2", m, (l-il));

	for (int i=0; i<l; i++)
	{
		if ( isWL1(i) )
		{
			fprintf (of1, "%d\t%d\t%d\n", 1, sector[i], ti[i]);
			if ( flag[i] == WORKLOAD2_DELOP )
			{
				fprintf (of2, "%d\t%d\n", 2, sector[i]);
			}
		}
		else
		{
			// Check if this needs to produce a delete operation
			if ( indices[i] < -1 )
			{
				int prev_index = -indices[i] - 1;
				if ( isWL1(prev_index) )
				{
					fprintf (of1, "%d\t%d\n", 2, sector[i]);
				}
			}

			fprintf (of2, "%d\t%d\n", 1, sector[i]);
		}
	}

	fclose(of1);
	fclose(of2);

	cout << "done" << endl;

	//-----------------------------------------------------------------------
	//------------ CLean up -------------------------------------------------
	//-----------------------------------------------------------------------
	clean_up();
}