{`Frame Time: ${frameTime}ms`}
- {systemProfileData.map((profileData) => {
- return (
- <>
-
{`System: ${profileData.uuid}`}
-
{`avg: ${Math.trunc(profileData.avgDuration * 1000) / 1000}ms \n max: ${
- Math.trunc(profileData.maxDuration * 1000) / 1000
- }ms`}
- >
- )
- })}
+
+ {'Benchmarked Systems: '}
+ {systemProfileData.map((profileData) => {
+ return (
+
+ {`System: ${profileData.uuid}`}
+ {`avg: ${Math.trunc(profileData.avgDuration * 1000) / 1000}ms \n max: ${
+ Math.trunc(profileData.maxDuration * 1000) / 1000
+ }ms`}
+
+ )
+ })}
+
+
+ {'Longest Running Systems: '}
+ {sortedSystemProfileData.map((system) => {
+ return (
+
+ {`System: ${system.uuid}`}
+ {`avg: ${Math.trunc(system.avgSystemDuration * 1000) / 1000}ms`}
+
+ )
+ })}
+
)
}
diff --git a/src/benchmarksAllRoute.tsx b/src/benchmarksAllRoute.tsx
index a048dab..2ff88f3 100644
--- a/src/benchmarksAllRoute.tsx
+++ b/src/benchmarksAllRoute.tsx
@@ -8,9 +8,9 @@ const BenchmarkAllRoute = () => {
const sceneEntity = useRouteScene()
useEffect(() => {
- if (!sceneEntity.value) return
+ if (!sceneEntity) return
- setComponent(sceneEntity.value, BenchmarkComponent)
+ setComponent(sceneEntity, BenchmarkComponent)
import('./engine/benchmarks/BenchmarkOrchestration')
}, [sceneEntity])
diff --git a/src/engine/benchmarks/AvatarBenchmark.tsx b/src/engine/benchmarks/AvatarBenchmark.tsx
index 3a25faa..ce51463 100644
--- a/src/engine/benchmarks/AvatarBenchmark.tsx
+++ b/src/engine/benchmarks/AvatarBenchmark.tsx
@@ -80,7 +80,7 @@ export const AvatarBenchmark = (props: { rootEntity: Entity; onComplete: () => v
}, [avatars])
useEffect(() => {
- if (onComplete && completedCount.value == avatarsToCreate) sleep(benchmarkWaitTime).then(onComplete)
+ if (completedCount.value == avatarsToCreate) sleep(benchmarkWaitTime).then(onComplete)
}, [completedCount.value == avatarsToCreate])
return (
diff --git a/src/engine/benchmarks/ParticlesBenchmark.ts b/src/engine/benchmarks/ParticlesBenchmark.ts
index bd38ecf..f3eef02 100644
--- a/src/engine/benchmarks/ParticlesBenchmark.ts
+++ b/src/engine/benchmarks/ParticlesBenchmark.ts
@@ -1,35 +1,24 @@
-import {
- Engine,
- Entity,
- EntityUUID,
- UUIDComponent,
- createEntity,
- getComponent,
- removeEntity,
- setComponent
-} from '@etherealengine/ecs'
+import { Engine, Entity, getComponent, removeEntity, setComponent } from '@etherealengine/ecs'
import { ParticleSystemComponent } from '@etherealengine/engine/src/scene/components/ParticleSystemComponent'
import { TransformComponent } from '@etherealengine/spatial'
import { Object3DComponent } from '@etherealengine/spatial/src/renderer/components/Object3DComponent'
import { VisibleComponent } from '@etherealengine/spatial/src/renderer/components/VisibleComponent'
-import { EntityTreeComponent } from '@etherealengine/spatial/src/transform/components/EntityTree'
import { useEffect } from 'react'
import { Group, MathUtils } from 'three'
+import { setupEntity } from '../../examples/utils/common/entityUtils'
const objectsToCreate = 30
const waitTimeBetween = 200
const simulateTime = 3000
const createParticleEntity = (rootEntity: Entity) => {
- const entity = createEntity()
+ const entity = setupEntity(rootEntity)
const position = getComponent(Engine.instance.cameraEntity, TransformComponent).position.clone()
position.setZ(position.z - 7.0)
position.setX(position.x + MathUtils.randFloat(-2.0, 2.0))
const obj3d = new Group()
obj3d.entity = entity
- setComponent(entity, UUIDComponent, MathUtils.generateUUID() as EntityUUID)
- setComponent(entity, EntityTreeComponent, { parentEntity: rootEntity })
setComponent(entity, Object3DComponent, obj3d)
setComponent(entity, TransformComponent, { position })
setComponent(entity, ParticleSystemComponent)
diff --git a/src/engine/benchmarks/PhysicsBenchmark.ts b/src/engine/benchmarks/PhysicsBenchmark.ts
index 10cef8f..aa81eda 100644
--- a/src/engine/benchmarks/PhysicsBenchmark.ts
+++ b/src/engine/benchmarks/PhysicsBenchmark.ts
@@ -1,13 +1,4 @@
-import {
- Engine,
- Entity,
- EntityUUID,
- UUIDComponent,
- createEntity,
- getComponent,
- removeEntity,
- setComponent
-} from '@etherealengine/ecs'
+import { Engine, Entity, getComponent, removeEntity, setComponent } from '@etherealengine/ecs'
import { PrimitiveGeometryComponent } from '@etherealengine/engine/src/scene/components/PrimitiveGeometryComponent'
import { GeometryTypeEnum } from '@etherealengine/engine/src/scene/constants/GeometryTypeEnum'
import { TransformComponent } from '@etherealengine/spatial'
@@ -15,9 +6,9 @@ import { ColliderComponent } from '@etherealengine/spatial/src/physics/component
import { RigidBodyComponent } from '@etherealengine/spatial/src/physics/components/RigidBodyComponent'
import { Object3DComponent } from '@etherealengine/spatial/src/renderer/components/Object3DComponent'
import { VisibleComponent } from '@etherealengine/spatial/src/renderer/components/VisibleComponent'
-import { EntityTreeComponent } from '@etherealengine/spatial/src/transform/components/EntityTree'
import { useEffect } from 'react'
import { Group, MathUtils, Vector3 } from 'three'
+import { setupEntity } from '../../examples/utils/common/entityUtils'
const objectsToCreate = 60
const waitTimeBetween = 200
@@ -26,15 +17,13 @@ const simulateTime = 3000
const scale = new Vector3(0.5, 0.5, 0.5)
const createPhysicsEntity = (rootEntity: Entity) => {
- const entity = createEntity()
+ const entity = setupEntity(rootEntity)
const position = getComponent(Engine.instance.cameraEntity, TransformComponent).position.clone()
position.setZ(position.z - 7.0)
position.setX(position.x + MathUtils.randFloat(-2.0, 2.0))
const obj3d = new Group()
obj3d.entity = entity
- setComponent(entity, UUIDComponent, MathUtils.generateUUID() as EntityUUID)
- setComponent(entity, EntityTreeComponent, { parentEntity: rootEntity })
setComponent(entity, Object3DComponent, obj3d)
setComponent(entity, TransformComponent, { position, scale })
setComponent(entity, PrimitiveGeometryComponent, {
diff --git a/src/engine/benchmarks/Profiling.ts b/src/engine/benchmarks/Profiling.ts
index 890a811..d6e5013 100644
--- a/src/engine/benchmarks/Profiling.ts
+++ b/src/engine/benchmarks/Profiling.ts
@@ -40,26 +40,26 @@ const execute = () => {
const engineVersion = global.__IR_ENGINE_VERSION__
const profileData = getMutableState(ProfileState)
const { gpu, device } = getState(PerformanceState)
- const systems = [...SystemDefinitions.values()]
+ const systems = SystemDefinitions.values()
const engineVersionData = profileData.systemProfilingData[engineVersion]
if (!engineVersionData[gpu].value) engineVersionData.merge({ [gpu]: {} })
const systemDataMap = engineVersionData[gpu]
+ const data = {}
for (const system of systems) {
- if (system.uuid == 'eepro.eetest.SystemProfilerSystem') continue
+ if (system.uuid === SystemProfilerSystem) continue
const max = systemDataMap[system.uuid].value ? systemDataMap[system.uuid].maxDuration.value : 0
- systemDataMap.merge({
- [system.uuid]: {
- avgDuration: system.avgSystemDuration,
- maxDuration: Math.max(max, system.systemDuration)
- }
- })
+ data[system.uuid] = {
+ avgDuration: system.avgSystemDuration,
+ maxDuration: Math.max(max, system.systemDuration)
+ }
}
+ systemDataMap.merge(data)
}
-export default defineSystem({
+export const SystemProfilerSystem = defineSystem({
uuid: 'eepro.eetest.SystemProfilerSystem',
execute,
insert: { after: PresentationSystemGroup }
diff --git a/src/examples/avatarMocap.tsx b/src/examples/avatarMocap.tsx
index d8f5262..7266024 100644
--- a/src/examples/avatarMocap.tsx
+++ b/src/examples/avatarMocap.tsx
@@ -233,5 +233,5 @@ function AvatarMocap(props: { sceneEntity: Entity }) {
export default function AvatarMocapEntry() {
const sceneEntity = useRouteScene()
- return sceneEntity.value ?