当前位置: 首页>>代码示例>>C++>>正文


C++ timer::elapsed方法代码示例

本文整理汇总了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();

}
开发者ID:jeromeCondere,项目名称:OpenGL-Confetti_canon,代码行数:60,代码来源:main.cpp

示例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);
    }
开发者ID:Julusian,项目名称:CasparCG-Server,代码行数:25,代码来源:newtek_ivga_consumer.cpp

示例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};
            }
开发者ID:vtnerd,项目名称:prima,代码行数:16,代码来源:run.hpp

示例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") ;
//    
开发者ID:theFlawlessHack,项目名称:DataStructuresAlgorithms,代码行数:31,代码来源:+JessicaJ_Real4.cpp

示例5: add

	// add a timer
	void add(timer const& t) { add(t.elapsed()); }
开发者ID:noma,项目名称:ham,代码行数:2,代码来源:time.hpp


注:本文中的timer::elapsed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。