#include "cyccounter.h" #include #include #include using namespace std; int main(int argc, char* argv[]){ if(argc != 3){ cerr << "Usage: " << argv[0] << " iterations modulus" << endl; return 1; } char *command = argv[0]; istringstream nstream(argv[1]), mstream(argv[2]); unsigned int n, m; nstream >> n; mstream >> m; unsigned int result = 0; volatile cycles start = read_cyccounter(); for(unsigned int i = 0; i < n; i++){ result = i % m; } cycles end = read_cyccounter(); cout << command << " " << n << " " << m << " " << result << " " << setfill('0') << setw(7) << end-start << endl; return 0; }