Refactored performance test code

Commented and flattened binary search sample.

Change-Id: Ib783292207c956d16003195924a3bcfbbde5039f
此提交包含在:
Chris Freehill
2017-05-05 23:50:42 -05:00
父節點 a777413400
當前提交 8161ebb915
共有 117 個檔案被更改,包括 46627 行新增 和 0 行删除
+45
查看文件
@@ -0,0 +1,45 @@
#include <iostream>
#include "hsatimer.h"
#include <unistd.h>
#include "utils_timer_test.hpp"
using namespace std;
// Destructor method of test driver
rocrtstUtilsTimerTest::~rocrtstUtilsTimerTest() { }
// Constructor method of test driver
//
// @brief loopCnt number of times to call sleep Api
//
// @brief sleepTimer time to sleep in milliseconds
rocrtstUtilsTimerTest::rocrtstUtilsTimerTest(uint32_t loopCnt, uint32_t sleepTime) :
loopCnt_(loopCnt), sleepTime_(sleepTime), total_time_(0) { }
// Execute user defined number of sleep calls and collect the
// total time taken by such calls
void rocrtstUtilsTimerTest::run() {
double time;
PerfTimer timer;
uint32_t index = timer.CreateTimer();
for (uint32_t idx; idx < loopCnt_; idx++) {
timer.StartTimer(index);
usleep(sleepTime_);
timer.StopTimer(index);
time = timer.ReadTimer(index);
total_time_ += time;
}
}
// Print time reported by Hsa Perf Utils Timer service
void rocrtstUtilsTimerTest::print() {
std::cout << "Time taken by " << loopCnt_;
std::cout << " iterations of sleep is: " << total_time_ << std::endl;
}