int main (int argc, char* const argv[]) { int i,j; char c; nodummy = 0; program_name = argv[0]; double u1, u2, total = 0; struct timeval tv; /* Get the input arguments */ option_set(argc,argv); /* Handle the input files */ handle_files (circuit_name,vectors_name); gettimeofday(&tv,NULL); u1 = tv.tv_sec*1.0e6 + tv.tv_usec; /* Read the circuit file and make the structures */ if (read_circuit (circuit_fd) < 0) system_error ("read_circuit"); fclose (circuit_fd); if (nog<=0 || nopi<=0 || nopo<=0) { fprintf(stderr,"Error in circuit file: #PI=%d, #PO=%d, #GATES=%d\n",nopi,nopo,nog); abort(); } /* Add a gate for the output stage as you did for the input stage */ nodummy = add_PO(); /* Compute the levels of the circuit */ allocate_stacks(); maxlevel = compute_level(); place_PO(); printf("the max level = %d\n",maxlevel); /* Computes the level of each gate */ allocate_event_list(); levelize(); //xfree(event_list); gettimeofday(&tv,NULL); u2 = tv.tv_sec*1.0e6 + tv.tv_usec; total=(u2-u1); printf("Time for construction of data structures: %f usec\n", total); total= 0; printf("opening vectors file= %s\n",vectors_name); vectors_fd = fopen (vectors_name, "r"); if (vectors_fd == NULL) system_error ("fopen"); gettimeofday(&tv,NULL); u1 = tv.tv_sec*1.0e6 + tv.tv_usec; /* Read the vector file and put the input values to the INPUT GATES */ if (read_vectors (vectors_fd,vectors_name) != 0) system_error ("read_vectors"); //fclose (vectors_fd); //valgrind mistake //logic simulation here LUT = create_lut (LUT); logic_sim(); i=0; j=0; if(test_name[0]=='\0') { while((c=circuit_name[i++])!='\0') { if(c=='/') j=0; else if(c=='.') break; else test_name[j++]=c; } test_name[j]='\0'; strcat(test_name,".test"); } gettimeofday(&tv,NULL); u2 = tv.tv_sec*1.0e6 + tv.tv_usec; total=(u2-u1); printf("Time for logic simulation: %f usec\n", total); total= 0; //print_logic_sim(); //<---------------------------------------------------------------- //fault simulation here gettimeofday(&tv,NULL); u1 = tv.tv_sec*1.0e6 + tv.tv_usec; create_fault_list (); //print_fault_list(); fault_sim(); gettimeofday(&tv,NULL); u2 = tv.tv_sec*1.0e6 + tv.tv_usec; total=(u2-u1); printf("Time for fault simulation: %f usec\n", total); total= 0; /*if ( fault_name == NULL ) { printf("\nWe are done\n"); return 0; } printf("opening fault file= %s\n",fault_name); vectors_fd = fopen (vectors_name, "r"); if (vectors_fd == NULL) system_error ("fopen"); */ // synexeia simulation<----------------------------------- printf("\nWe are done\n"); return 0; }
static int qcms_test_tetra_clut_rgba(size_t width, size_t height, int iterations, const char *in_profile, const char *out_profile, const int force_software) { qcms_transform transform0, transform1; qcms_format_type format = {2, 0}; uint16_t samples = 33; size_t lutSize; float *lut0, *lut1; const size_t length = width * height; const size_t pixel_size = 4; double time0, time1; int i; printf("Test qcms clut transforms for %d iterations\n", iterations); printf("Test image size %u x %u pixels\n", (unsigned) width, (unsigned) height); fflush(stdout); srand(0); seconds(); memset(&transform0, 0, sizeof(transform0)); memset(&transform1, 0, sizeof(transform1)); transform0.grid_size = samples; transform1.grid_size = samples; transform0.transform_flags = 0; transform1.transform_flags = 0; lutSize = 3 * samples * samples * samples; lut0 = create_lut(lutSize); lut1 = (float *)malloc(lutSize * sizeof(float)); memcpy(lut1, lut0, lutSize * sizeof(float)); transform0.r_clut = &lut0[0]; transform0.g_clut = &lut0[1]; transform0.b_clut = &lut0[2]; transform1.r_clut = &lut1[0]; transform1.g_clut = &lut1[1]; transform1.b_clut = &lut1[2]; // Re-generate and use different data sources during the iteration loop // to avoid compiler / cache optimizations that may affect performance. time0 = 0.0; time1 = 0.0; for (i = 0; i < iterations; ++i) { unsigned char *src0 = (unsigned char *)calloc(length, pixel_size); unsigned char *src1 = (unsigned char *)calloc(length, pixel_size); unsigned char *dst0 = (unsigned char *)calloc(length, pixel_size); unsigned char *dst1 = (unsigned char *)calloc(length, pixel_size); generate_source_uint8_t(src0, length, pixel_size); memcpy(src1, src0, length * pixel_size); #define TRANSFORM_TEST0 qcms_transform_data_tetra_clut_rgba #define TRANSFORM_TEST1 qcms_transform_data_tetra_clut_rgba_sse2 TIME(TRANSFORM_TEST0(&transform0, src0, dst0, length, format), &time0); TIME(TRANSFORM_TEST1(&transform1, src1, dst1, length, format), &time1); if (!validate(dst0, dst1, length, 0, pixel_size)) { fprintf(stderr, "Invalid transform output: %d diffs\n", diffs); } free(src0); free(src1); free(dst0); free(dst1); } #define STRINGIZE(s) #s #define STRING(s) STRINGIZE(s) printf("%.6lf (avg %.6lf) seconds " STRING(TRANSFORM_TEST0) "\n", time0, time0 / iterations); printf("%.6lf (avg %.6lf) seconds " STRING(TRANSFORM_TEST1) "\n", time1, time1 / iterations); printf("%.6lf speedup after %d iterations\n\n", time0 / time1, iterations); free(lut0); free(lut1); return diffs; }