/** * Print Statistics for the generated Packets * * Description:\n * Prints Total number of packets sent, the elapsed time, * the mean power, mean real and imaginary values for the samples * for both LCP and RCP * */ void printStatistics() { timeval end; gettimeofday(&end, NULL); int32_t sec = end.tv_sec - start.tv_sec; int32_t usec = end.tv_usec - start.tv_usec; if (usec < 0) { usec += 1000000; --sec; } cout << packet << " packets sent in " << sec << "." << usec << " seconds" << endl; int32_t maxQueue = sndX->getSendHWM(); cout << "maximum output queue X " << maxQueue << endl; maxQueue = sndY->getSendHWM(); cout << "maximum output queue Y " << maxQueue << endl; int64_t samples; float64_t total; ComplexFloat64 power; ComplexFloat64 fSum; ComplexInt64 iSum; /** * X pol Statistics */ samples = genX.getSampleCnt(); power = genX.getPower(); total = power.real() + power.imag(); cout << "X pol" << endl; cout << samples << " samples, average (float) sample power = "; cout << total / samples << endl; cout << "power (float): re = " << power.real() << ", im = " << power.imag(); cout << ", total = " << total << endl; #ifdef notdef power = genX.getIntegerPower(); total = power.real() + power.imag(); cout << samples << " samples, average (short) sample power = "; cout << total / samples << endl; cout << "power (integer): re = " << power.real() << ", im = "; cout << power.imag() << ", total = " << total << endl; #endif fSum = genX.getSum(); cout << "sum of amplitudes (float64) = (" << fSum.real(); cout << ", " << fSum.imag() << ")" << endl; cout << "avg of amplitudes (float64) = (" << fSum.real() / samples; cout << ", " << fSum.imag() / samples << ")" << endl; #ifdef notdef iSum = genX.getIntegerSum(); cout << "sum of amplitudes (short) = (" << iSum.real(); cout << ", " << iSum.imag() << ")" << endl; cout << "avg of amplitudes (short) = ("; cout << (float64_t) iSum.real() / samples; cout << ", " << (float64_t) iSum.imag() / samples << ")" << endl; #endif /** * Y pol Statistics */ samples = genY.getSampleCnt(); power = genY.getPower(); total = power.real() + power.imag(); cout << "Y pol" << endl; cout << samples << " samples, average (float) sample power = "; cout << total / samples << endl; cout << "power (float): re = " << power.real() << ", im = " << power.imag(); cout << ", total = " << total << endl; #ifdef notdef power = genY.getIntegerPower(); total = power.real() + power.imag(); cout << samples << " samples, average (short) sample power = "; cout << total / samples << endl; cout << "power (integer): re = " << power.real() << ", im = "; cout << power.imag() << ", total = " << total << endl; #endif fSum = genY.getSum(); cout << "sum of amplitudes (float64) = (" << fSum.real(); cout << ", " << fSum.imag() << ")" << endl; cout << "avg of amplitudes (float64) = (" << fSum.real() / samples; cout << ", " << fSum.imag() / samples << ")" << endl; #ifdef notdef iSum = genY.getIntegerSum(); cout << "sum of amplitudes (short) = (" << iSum.real(); cout << ", " << iSum.imag() << ")" << endl; cout << "avg of amplitudes (short) = ("; cout << (float64_t) iSum.real() / samples; cout << ", " << (float64_t) iSum.imag() / samples << ")" << endl; #endif }