From fea3c20576d195609dac1276344ce9c5252140d7 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Tue, 17 Jul 2007 17:57:46 +0000 Subject: * renamed MySceneObject to CpuCounterObject --- .../Region/Examples/SimpleApp/CpuCounterObject.cs | 35 ++++++++++++++++++++++ OpenSim/Region/Examples/SimpleApp/MySceneObject.cs | 35 ---------------------- OpenSim/Region/Examples/SimpleApp/Program.cs | 2 +- 3 files changed, 36 insertions(+), 36 deletions(-) create mode 100644 OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs delete mode 100644 OpenSim/Region/Examples/SimpleApp/MySceneObject.cs (limited to 'OpenSim/Region/Examples/SimpleApp') diff --git a/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs b/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs new file mode 100644 index 0000000..26ecf01 --- /dev/null +++ b/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Region.Environment.Scenes; +using libsecondlife; +using OpenSim.Framework.Types; +using System.Timers; +using System.Diagnostics; + +namespace SimpleApp +{ + public class CpuCounterObject : SceneObject + { + private PerformanceCounter m_counter; + + public CpuCounterObject(Scene world, EventManager eventManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) + : base(world, eventManager, ownerID, localID, pos, shape ) + { + String objectName = "Processor"; + String counterName = "% Processor Time"; + String instanceName = "_Total"; + + m_counter = new PerformanceCounter(objectName, counterName, instanceName); + } + + public override void Update( ) + { + float cpu = m_counter.NextValue() / 40f; + LLVector3 size = new LLVector3(cpu, cpu, cpu); + rootPrimitive.ResizeGoup( size ); + + base.Update(); + } + } +} diff --git a/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs b/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs deleted file mode 100644 index 3828b9d..0000000 --- a/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.Region.Environment.Scenes; -using libsecondlife; -using OpenSim.Framework.Types; -using System.Timers; -using System.Diagnostics; - -namespace SimpleApp -{ - public class MySceneObject : SceneObject - { - private PerformanceCounter m_counter; - - public MySceneObject(Scene world, EventManager eventManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) - : base(world, eventManager, ownerID, localID, pos, shape ) - { - String objectName = "Processor"; - String counterName = "% Processor Time"; - String instanceName = "_Total"; - - m_counter = new PerformanceCounter(objectName, counterName, instanceName); - } - - public override void Update( ) - { - float cpu = m_counter.NextValue() / 40f; - LLVector3 size = new LLVector3(cpu, cpu, cpu); - rootPrimitive.ResizeGoup( size ); - - base.Update(); - } - } -} diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs index 9d798de..4dae461 100644 --- a/OpenSim/Region/Examples/SimpleApp/Program.cs +++ b/OpenSim/Region/Examples/SimpleApp/Program.cs @@ -62,7 +62,7 @@ namespace SimpleApp shape.Scale = new LLVector3(0.5f, 0.5f, 0.5f); LLVector3 pos = new LLVector3(138, 129, 27); - SceneObject m_sceneObject = new MySceneObject(scene, scene.EventManager, LLUUID.Zero, scene.PrimIDAllocate(), pos, shape); + SceneObject m_sceneObject = new CpuCounterObject(scene, scene.EventManager, LLUUID.Zero, scene.PrimIDAllocate(), pos, shape); scene.AddEntity(m_sceneObject); MyNpcCharacter m_character = new MyNpcCharacter( scene.EventManager ); -- cgit v1.1