本文整理汇总了C++中timer::restart方法的典型用法代码示例。如果您正苦于以下问题:C++ timer::restart方法的具体用法?C++ timer::restart怎么用?C++ timer::restart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类timer
的用法示例。
在下文中一共展示了timer::restart方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: push
void push(Queue& queue, size_t n, timer& t)
{
t.restart();
for(size_t i=0; i<n; i++)
queue.push();
t.stop();
}
示例2: make_ready_future
std::future<bool> send(core::const_frame frame) override
{
CASPAR_VERIFY(format_desc_.height * format_desc_.width * 4 == frame.image_data(0).size());
graph_->set_value("tick-time", tick_timer_.elapsed() * format_desc_.fps * 0.5);
tick_timer_.restart();
caspar::timer frame_timer;
{
auto audio_buffer = core::audio_32_to_16(frame.audio_data());
airsend::add_audio(air_send_.get(),
audio_buffer.data(),
static_cast<int>(audio_buffer.size()) / format_desc_.audio_channels);
}
{
connected_ = airsend::add_frame_bgra(air_send_.get(), frame.image_data(0).begin());
}
graph_->set_text(print());
graph_->set_value("frame-time", frame_timer.elapsed() * format_desc_.fps * 0.5);
return make_ready_future(true);
}
示例3: main
int main()
{
vector<recorder<timer> > stats(2);
for(int i = 0; i < 2; i++)
stats[i].reset();
int size = 1000000;
Resistive gh(6);
//for(int i =0; i < size; i++)
// gh.addEdge(i, i+1, i+1);
//for(int i = 0; i < size; i++)
// gh.addEdge(0, 1, i+1);
// for(int i = 0; i < size; i++) {
// for(int jazz = 0; jazz < 1000; jazz++)
// gh.addEdge(i, i+1, 100);
// }
gh.addEdge(0, 1, 2);
gh.addEdge(0, 1, 8);
gh.addEdge(0, 5, 10);
gh.addEdge(0, 2, 20);
gh.addEdge(0, 2, 30);
gh.addEdge(0, 2, 60);
gh.addEdge(1, 3, 9);
gh.addEdge(1, 3, 6);
gh.addEdge(2, 4, 90);
gh.addEdge(3, 5, 3);
gh.addEdge(4, 5, 3);
gh.addEdge(4, 5, 100);
gh.addEdge(4, 5, 15);
gh.printGraph();
timer1.restart();
double ans = gh.traverse(0, 5);
timer1.stop();
stats[0].record(timer1);
cout << "-----------------" << endl;
gh.printGraph();
// print the adjacency list representation of the above graph
cout << endl << "TIME: ";
stats[0].report(cout);
cout << endl << ans << endl;
double test = 0;
for(int n = 1; n <= size; n++)
test += n;
return 0;
}
示例4: main
int main()
{
const unsigned int START_SIZE = 32768;
unsigned int largest_size = START_SIZE * pow(2,10);
unsigned int elems_tested = START_SIZE * 16;
//unsigned int current_size = START_SIZE;
//unsigned int old_size = 0;
// int max_size = START_SIZE^(INCREMENT_FACTOR*number_of_trials);
// for our outputting of the results
ofstream ofs("results.txt");
// this is going to hold the measurements
vector<recorder<timer> > stats(number_of_algorithms);
// The "U" is the type for the queues x and y (poorly named, i know). Using the largest sequence multiplied by factor to allocate memory
//EMAQueue<U> x(current_size);
cout << "________";
for (int i = 0; i < number_of_algorithms; ++i)
cout << headings[i];
cout << endl;
cout << " Range ";
for (int i = 0; i < number_of_algorithms; ++i)
cout << "| Time ";
cout << endl;
//initialize vector of ints
vector<int> testVector;
//initialize vector of keys
vector<int> keyVector;
//initialize random stuff
std::random_device rd; // obtain a random number from hardware
std::mt19937 eng(rd()); // seed the generator
std::uniform_int_distribution<> distr(START_SIZE, largest_size); // define the range
for (unsigned int i = 0; i < elems_tested; ++i) {
testVector.push_back(distr(eng));
keyVector.push_back(testVector[i]%101);
}
for (int count = 0; count < number_of_trials; count ++)
{
//displays the number of elements that will be added to the data structures
cout << setw(8) << 1+ largest_size - START_SIZE << flush;
ofs << setw(8) << 1+ largest_size - START_SIZE;
//resets stats
for (int i = 0; i < number_of_algorithms; ++i)
stats[i].reset();
//start of testing
for (int j = 0; j < number_of_trials; ++j)
{
//initialize data structures each trial
Hashtable<unsigned int> emHash;
unordered_map<unsigned int, unsigned int> stlMap;
HashMap sepChain;
hashdict<unsigned int, unsigned int> bookHash(elems_tested, -1);
//does test for each algorithm
for (int i = 0; i < number_of_algorithms; ++i)
{
//resets timer
timer1.restart();
//completes the test "current_size" times
for (unsigned int k = 0; k < elems_tested; ++k)
{
//data type operations to be tested
switch (i)
{
//insert values to Emily's Hash
case 0: emHash.insert(testVector[k]);
//emHash.insert(k);
break;
case 1: stlMap.insert(make_pair(keyVector[k], testVector[k]));
//stlMap.insert(k, k);
break;
/*
case 2: //sepChain.insert(testVector[k]);
//sepChain.insert(k);
break;
case 3: //bookHash.insert(keyVector[k], testVector[k]);
//bookHash.insert(k, k);
break;
*/
case 2: emHash.remove(testVector[k]);
//emHash.remove(k);
break;
case 3: stlMap.erase(testVector[k]);
//stlMap.erase(k);
/* break;
case 6: //sepChain.remove(testVector[k]);
//sepChain.remove(k);
break;
case 7: bookHash.removeAny();
*/
}
}
//stops timer
timer1.stop();
//.........这里部分代码省略.........