Esempio n. 1
0
int main()
{
	using std::clock; 

	ShowWindow(GetConsoleWindow(), SW_MAXIMIZE);

	auto timeStart(clock());
	const MidiParser_Facade midi("../../../Test.mid");
	auto runDuration(clock() - timeStart);

	timeStart = clock();
	for (auto iter(midi.GetNotes().cbegin()); iter != midi.GetNotes().cend(); ++iter)
	{
		printf("TRACK #%d of %u\n", static_cast<int>(iter - midi.GetNotes().cbegin() + 1),
			static_cast<unsigned>(midi.GetNotes().size()));
		for (auto jiter(iter->cbegin()); jiter != iter->cend(); ++jiter)
		{
			printf("Time %u Note %d\t", midi.GetMilliSeconds()
				.at(static_cast<size_t>(iter - midi.GetNotes().cbegin()))
				.at(static_cast<size_t>(jiter - iter->cbegin())),
				*jiter);
		}
		printf("\nEND OF TRACK #%d of %u\n\n", static_cast<int>(iter - midi.GetNotes().cbegin() + 1),
			static_cast<unsigned>(midi.GetNotes().size()));
	}
	puts("===================\nEND OF ALL TRACKS\n===================");
	const auto printDuration(clock() - timeStart);
	printf("\nRun time = %f seconds\tPrint time = %f seconds\nTotal time = %f seconds\n",
		static_cast<float>(runDuration) / CLOCKS_PER_SEC, static_cast<float>(printDuration) / CLOCKS_PER_SEC,
		static_cast<float>(runDuration + printDuration) / CLOCKS_PER_SEC);

	printf("\n\n%s", midi.GetLog().c_str());
}
Esempio n. 2
0
int main(int argc, char** argv) {
	list<int> test1 = list<int>();
	list<int> test2 = list<int>();

	init(test1);
	init(test2);

	cout << "Done initializing...\n";

	// print(test1);
	// print(test2);

	// clock_t startTime = clock();
	// list<int> list3 = nSquaredDifference(test1, test2);
	// clock_t runTime = clock() - startTime;
	// cout << "n^2 runtime: " << ((float) runTime) / CLOCKS_PER_SEC << "\n";
	
	//print(list3);

	// clock_t startTime = clock();
	// list<int> list4 = nLogNDifference(test1, test2);
	// clock_t runTime = clock() - startTime;
	// cout << "nlogn runtime: " << ((float) runTime) / CLOCKS_PER_SEC << "\n";
	
	// print(list4);

	clock_t startTime = clock();
	list<int> list5 = nDifference(test1, test2);
	clock_t runTime = clock() - startTime;
	cout << "n runtime: " << ((float) runTime) / CLOCKS_PER_SEC << "\n";
	// print(list5);
}
int main(int argc, char **argv)
{
    progname = argv[0];
    if (argc < 5)
    {
        usage();
    }

    clock_t start = clock();
    WholeGenomeAlignment wga(argv[2], GetAlignmentBlockStorage(argv[4]));

    {
        set<string> filter;
        filter.insert(argv[2]);
        for (int i = 5; i < argc; ++i)
        {
            filter.insert(argv[i]);
        }

        BitSequenceFactory * factory = GetSequenceFactory(argv[3]);

        if (filter.size() > 1)
        {
            ReadMafFile(argv[1], wga, *factory, &filter);
        }
        else
        {
            ReadMafFile(argv[1], wga, *factory);
        }

        delete factory;
    }
    clock_t end = clock();
    cerr.precision(10);
    cerr << "Parsed MAF in " << clock_to_sec(end - start) <<
            " seconds." << endl;

    size_t reference_size = wga.getReferenceSize();

    while (1)
    {
        size_t position = rand() % reference_size;
        try
        {
            WholeGenomeAlignment::PositionMapping *mapping;
            mapping = wga.mapPositionToAll(position);
            if (mapping->begin() == mapping->end())
            {
                delete mapping;
                throw OutOfSequence();
            }
            cout << mapping->begin()->first << "\t" << position << endl;
            delete mapping;
        }
        catch (OutOfSequence &e)
        { }
    }
}
int main(int argc, char **argv)
{
	glutInit(&argc,argv);
	int t;
	double time;
	int iterations = 250;

	//cin >> iterations;
	//if(argc == 2)
		cout << "success? " << (timeBeginPeriod(1)==TIMERR_NOERROR) << endl;

	LARGE_INTEGER clockFrequency;
	QueryPerformanceFrequency(&clockFrequency);
	cout << "f = " << clockFrequency.QuadPart << " Hz" << endl;
	cout << "T = " << 1000.0/clockFrequency.QuadPart << " ms" << endl;

	LARGE_INTEGER start,stop;
	QueryPerformanceCounter(&start);
	for(int c = 0 ; c < iterations ; c++)
		;
	QueryPerformanceCounter(&stop);
	cout << stop.QuadPart-start.QuadPart << endl;

	time = CPUclock::currentTime();
	for(int c = 0 ; c < iterations ; c++)
		;
	cout << CPUclock::currentTime()-time << endl;

	t = timeGetTime();
	for(int c = 0 ; c < iterations ; c++)
		cout << '.';
	cout << timeGetTime()-t << endl;

	t = clock();
	for(int c = 0 ; c < iterations ; c++)
		cout << '.';
	cout << clock()-t << endl;

	t = glutGet(GLUT_ELAPSED_TIME);
	for(int c = 0 ; c < iterations ; c++)
		cout << '.';
	cout << glutGet(GLUT_ELAPSED_TIME)-t << endl;

	//if(argc == 2)
		timeEndPeriod(1);
	system("PAUSE");
	return 0;
} // end function main
Esempio n. 5
0
int main()
{
  cout << clock() << '\n';
  try
  {
    f(0);
  }
  catch(myErr)
  {
  }
  cout << clock() << '\n';
  try
  {
    f(1);
  }
  catch(myErr)
  {
  }
  cout << clock() << '\n';

 
}
Esempio n. 6
0
int main(int argc, char** argv) {
	list<int> list1;
	list<int> list2;
	clock_t startTime;

	init(list1);
	init(list2);

	// print(list1);
	// print(list2);
	startTime = clock();
	list<int> list3 = nSquaredUnion(list1, list2);
	// print(list3);
	cout << "Time for n^2 Union: " << clock() - startTime << "\n";

	startTime = clock();
	list<int> list4 = nLogNUnion(list1, list2);
	// print(list4);
	cout << "Time for nlogn Union: " << clock() - startTime << "\n";

	startTime = clock();
	list<int> list5 = nSquaredIntersection(list1, list2);
	// print(list5);
	cout << "Time for n^2 Intersection: " << clock() - startTime << "\n";

	startTime = clock();
	list<int> list6 = nLogNIntersection(list1, list2);
	// print(list6);
	cout << "Time for nlogn Intersection: " << clock() - startTime << "\n";

	cout << "\n";

	cout << list1.size() << "\n";
	cout << list2.size() << "\n";
	cout << list3.size() << "\n";
	cout << list4.size() << "\n";
	cout << list5.size() << "\n";
	cout << list6.size() << "\n";
	// cout << list1.size() << "\n";
	// cout << list2.size() << "\n";

}