Loading benchmark.c +13 −22 Original line number Diff line number Diff line Loading @@ -6,44 +6,35 @@ #include <time.h> static char cmd_add[] = "./md --addMolecule testcases/molecules/"; static char cmd_find[] = "./md --findMolecule testcases/molecules/"; static char cmd_find[] = "./md --findMolecule testcases/new_molecules/"; int main(void) { clock_t start = clock(); DIR *molecule_directory; molecule_directory = opendir("testcases/molecules/"); molecule_directory = opendir("testcases/new_molecules/"); struct dirent *molecule; char cmd_buffer[80]; strcpy(cmd_buffer, cmd_add); // strcpy(&cmd_buffer[sizeof(cmd_add)-1], "test.txt"); // printf("%s\n", cmd_buffer); // return 0; strcpy(cmd_buffer, cmd_find); if (molecule_directory) { while ((molecule = readdir(molecule_directory)) != NULL) { // printf("%s\n", molecule->d_name); strcpy(&cmd_buffer[sizeof(cmd_add)-1], molecule->d_name); if (molecule->d_type == DT_REG) { strcpy(&cmd_buffer[sizeof(cmd_find) - 1], molecule->d_name); system(cmd_buffer); } } closedir(molecule_directory); } // // clock_t start = clock(); // for (int i = 0; i < 10000; i++) // { // system("./md --addMolecule Molecules/acetylene.txt"); // } // for (int i = 0; i < 10000; i++) // { // system("./md --findMolecule Molecules/biotin.txt"); // } // // clock_t diff = clock() - start; // // int m_sec = diff * 1000 / CLOCKS_PER_SEC; // // printf("time taken %d seconds %d milliseconds\n", m_sec/1000, m_sec % 1000); clock_t diff = clock() - start; int m_sec = diff * 1000 / CLOCKS_PER_SEC; printf("time taken %d seconds %d milliseconds\n", m_sec / 1000, m_sec % 1000); return 0; } Loading
benchmark.c +13 −22 Original line number Diff line number Diff line Loading @@ -6,44 +6,35 @@ #include <time.h> static char cmd_add[] = "./md --addMolecule testcases/molecules/"; static char cmd_find[] = "./md --findMolecule testcases/molecules/"; static char cmd_find[] = "./md --findMolecule testcases/new_molecules/"; int main(void) { clock_t start = clock(); DIR *molecule_directory; molecule_directory = opendir("testcases/molecules/"); molecule_directory = opendir("testcases/new_molecules/"); struct dirent *molecule; char cmd_buffer[80]; strcpy(cmd_buffer, cmd_add); // strcpy(&cmd_buffer[sizeof(cmd_add)-1], "test.txt"); // printf("%s\n", cmd_buffer); // return 0; strcpy(cmd_buffer, cmd_find); if (molecule_directory) { while ((molecule = readdir(molecule_directory)) != NULL) { // printf("%s\n", molecule->d_name); strcpy(&cmd_buffer[sizeof(cmd_add)-1], molecule->d_name); if (molecule->d_type == DT_REG) { strcpy(&cmd_buffer[sizeof(cmd_find) - 1], molecule->d_name); system(cmd_buffer); } } closedir(molecule_directory); } // // clock_t start = clock(); // for (int i = 0; i < 10000; i++) // { // system("./md --addMolecule Molecules/acetylene.txt"); // } // for (int i = 0; i < 10000; i++) // { // system("./md --findMolecule Molecules/biotin.txt"); // } // // clock_t diff = clock() - start; // // int m_sec = diff * 1000 / CLOCKS_PER_SEC; // // printf("time taken %d seconds %d milliseconds\n", m_sec/1000, m_sec % 1000); clock_t diff = clock() - start; int m_sec = diff * 1000 / CLOCKS_PER_SEC; printf("time taken %d seconds %d milliseconds\n", m_sec / 1000, m_sec % 1000); return 0; }