本文整理汇总了C++中timer::elapsed方法的典型用法代码示例。如果您正苦于以下问题:C++ timer::elapsed方法的具体用法?C++ timer::elapsed怎么用?C++ timer::elapsed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类timer
的用法示例。
在下文中一共展示了timer::elapsed方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: display
static void display()
{static int n;
glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);
glLoadIdentity();
static glShaderManager SM;
static glShader *shader;
if(!n)
{
shader= SM.loadfromFile("vert2.txt","frag2.txt");
}
static timer t;
double t2=t.elapsed();
glPointSize(23);
static vector< particule> v;
Repere();
if(!n)
{
for(int i=0;i<2000;i++)
{
v.push_back(particule(45,20,8,1,i));
}
}
shader->begin();
int c=v.size();
for(int i=0;i<c;i++)
{
shader->setUniform1f("p.alpha",v[i].getAlpha(),shader->GetUniformLocation("p.alpha"));
shader->setUniform1f("p.beta",v[i].getBeta(),shader->GetUniformLocation("p.beta"));
shader->setUniform1f("p.vIn",v[i].getInitV(),shader->GetUniformLocation("p.vIn"));
shader->setUniform1f("p.t",t2/2,shader->GetUniformLocation("p.t"));
shader->setUniform1f("p.start",v[i].getStart(),shader->GetUniformLocation("p.start"));
shader->setUniform1f("p.life",v[i].getLife(),shader->GetUniformLocation("p.life"));
v[i].draw(0,0,0);
}
shader->end();
n++;
if(n>2)
n=1;
glutSwapBuffers();
}
示例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: measure
results measure(const Implementation& implementation) const
{
// Run a few times in an attempt to pull code pages into CPU
// cache
execute(implementation);
execute(implementation);
timer::duration elapsed{0};
unsigned result{0};
{
const timer time;
result = execute(implementation);
elapsed = time.elapsed();
}
return {elapsed, result};
}
示例4: elapsed
// For the vector and list class, use the STL algorithm lower bound.
// For the set and unordered set class, use the container’s method find.
class timer {
public:
timer() : start(clock()) {}
double elapsed() { return ( clock() - start ) / CLOCKS_PER_SEC; }
void reset() { start = clock(); }
private:
double start;
};
timer t;
double duration = t.elapsed();
string testWord = "luge";
// look up lower bound algorithms
// look up how to do a find within sets andunordered sets.
// also double check whether you can make open the ENABLE file!!!
int main(){
// cout << "//======================================= PART TWO =======================================//" << endl;
//
// vector<Student> compVec{Student("Lisa"),Student("Jessica"), Student("Marie"), Student("Apple")};
//
// meFirst myComp("Monty") ;
//
示例5: add
// add a timer
void add(timer const& t) { add(t.elapsed()); }