Ejemplo n.º 1
0
    unsafe int RunCPUBenchmark(peUpdateRoutine r, bool mt, string text)
    {
        IntPtr   ctx = peCreateContext(BenchmarkParticleCount);
        peParams p   = default(peParams);

        p.pressure_stiffness = m_pressure_stiffness;
        p.wall_stiffness     = m_wall_stiffness;
        p.particle_size      = m_particle_size;
        p.update_velocity    = Update_Velocity;
        p.update_position    = Update_Position;
        p.routine            = r;
        p.multi_threading    = mt;
        peSetParams(ctx, ref p);

        float elapsed_total = 0.0f;
        int   num_try       = 0;

        while (elapsed_total < BenchmarkTimeout)
        {
            float t = Time.realtimeSinceStartup;
            peUpdate(ctx, BenchmarkDeltaTime);
            elapsed_total += Time.realtimeSinceStartup - t;
            ++num_try;
        }
        peDestroyContext(ctx);

        m_output.text = m_output.text + text + (elapsed_total / num_try * 1000.0f).ToString("0.0") + "ms\n";
        return(0);
    }
Ejemplo n.º 2
0
    unsafe int RunCPUBenchmark(peUpdateRoutine r, bool mt, string text)
    {
        IntPtr ctx = peCreateContext(BenchmarkParticleCount);
        peParams p = default(peParams);
        p.pressure_stiffness = m_pressure_stiffness;
        p.wall_stiffness = m_wall_stiffness;
        p.particle_size = m_particle_size;
        p.update_velocity = Update_Velocity;
        p.update_position = Update_Position;
        p.routine = r;
        p.multi_threading = mt;
        peSetParams(ctx, ref p);

        float elapsed_total = 0.0f;
        int num_try = 0;
        while (elapsed_total < BenchmarkTimeout)
        {
            float t = Time.realtimeSinceStartup;
            peUpdate(ctx, BenchmarkDeltaTime);
            elapsed_total += Time.realtimeSinceStartup - t;
            ++num_try;
        }
        peDestroyContext(ctx);

        m_output.text = m_output.text + text + (elapsed_total / num_try * 1000.0f).ToString("0.0") + "ms\n";
        return 0;
    }
Ejemplo n.º 3
0
 public void SetUpdateRoutibe(int v)
 {
     m_routine = (peUpdateRoutine)v;
 }
Ejemplo n.º 4
0
 public void SetUpdateRoutibe(int v)
 {
     m_routine = (peUpdateRoutine)v;
 }