time tracking in grid2
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
0f4379920b
commit
eed5f79130
2
src/main/c/includes/fluid/env/environment.h
vendored
2
src/main/c/includes/fluid/env/environment.h
vendored
@ -72,6 +72,8 @@ typedef struct {
|
||||
double existingDensity;
|
||||
double newDensity;
|
||||
double normalizationRatio;
|
||||
double densityTime;
|
||||
double velocityTime;
|
||||
int frame;
|
||||
} FluidSimState;
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <immintrin.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
//native interfaces
|
||||
#include "native/electrosphere_server_fluid_simulator_FluidAcceleratedSimulator.h"
|
||||
@ -43,6 +44,11 @@ float * fluid_grid2_neighborArr_v0;
|
||||
float * fluid_grid2_neighborArr_w0;
|
||||
float * fluid_grid2_neighborArr_bounds;
|
||||
|
||||
/**
|
||||
* Used for storing timings
|
||||
*/
|
||||
static struct timeval tv;
|
||||
|
||||
LIBRARY_API void fluid_grid2_simulate(
|
||||
int numChunks,
|
||||
Chunk ** passedInChunks,
|
||||
@ -50,8 +56,11 @@ LIBRARY_API void fluid_grid2_simulate(
|
||||
jfloat timestep
|
||||
){
|
||||
Chunk ** chunks = passedInChunks;
|
||||
double start, end, perMilli;
|
||||
|
||||
|
||||
gettimeofday(&tv,NULL);
|
||||
start = 1000000.0 * tv.tv_sec + tv.tv_usec;
|
||||
//
|
||||
//Velocity step
|
||||
//
|
||||
@ -110,7 +119,12 @@ LIBRARY_API void fluid_grid2_simulate(
|
||||
}
|
||||
|
||||
|
||||
|
||||
//get time at end
|
||||
gettimeofday(&tv,NULL);
|
||||
end = 1000000.0 * tv.tv_sec + tv.tv_usec;
|
||||
perMilli = (end - start) / 1000.0f;
|
||||
environment->state.velocityTime = perMilli;
|
||||
start = end;
|
||||
|
||||
///------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
///------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@ -144,6 +158,12 @@ LIBRARY_API void fluid_grid2_simulate(
|
||||
fluid_grid2_advectDensity(currentChunk->d,currentChunk->d0,currentChunk->u,currentChunk->v,currentChunk->w,timestep);
|
||||
}
|
||||
|
||||
//get time at end
|
||||
gettimeofday(&tv,NULL);
|
||||
end = 1000000.0 * tv.tv_sec + tv.tv_usec;
|
||||
perMilli = (end - start) / 1000.0f;
|
||||
environment->state.densityTime = perMilli;
|
||||
|
||||
|
||||
//
|
||||
//mirror densities
|
||||
|
||||
@ -110,6 +110,8 @@ int fluid_sim_grid2_speed_test1(){
|
||||
printf("Frame time per chunk (micro): %lf \n",avgPerChunk);
|
||||
printf("Frame time per chunk (milli): %lf \n",perMilli);
|
||||
printf("Target time (milli): %f \n",TIME_PER_CHUNK);
|
||||
printf("Velocity time (milli): %f \n",env->state.velocityTime);
|
||||
printf("Density time (milli): %f \n",env->state.densityTime);
|
||||
printf("\n");
|
||||
rVal++;
|
||||
}
|
||||
@ -162,6 +164,8 @@ int fluid_sim_grid2_speed_test2(){
|
||||
printf("Frame time per chunk (micro): %lf \n",avgPerChunk);
|
||||
printf("Frame time per chunk (milli): %lf \n",perMilli);
|
||||
printf("Target time (milli): %f \n",TIME_PER_CHUNK);
|
||||
printf("Velocity time (milli): %f \n",env->state.velocityTime);
|
||||
printf("Density time (milli): %f \n",env->state.densityTime);
|
||||
printf("\n");
|
||||
rVal++;
|
||||
}
|
||||
@ -214,6 +218,8 @@ int fluid_sim_grid2_speed_test3(){
|
||||
printf("Frame time per chunk (micro): %lf \n",avgPerChunk);
|
||||
printf("Frame time per chunk (milli): %lf \n",perMilli);
|
||||
printf("Target time (milli): %f \n",TIME_PER_CHUNK);
|
||||
printf("Velocity time (milli): %f \n",env->state.velocityTime);
|
||||
printf("Density time (milli): %f \n",env->state.densityTime);
|
||||
printf("\n");
|
||||
rVal++;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user