diff options
author | lbsa71 | 2007-07-17 17:57:46 +0000 |
---|---|---|
committer | lbsa71 | 2007-07-17 17:57:46 +0000 |
commit | fea3c20576d195609dac1276344ce9c5252140d7 (patch) | |
tree | db0042c594c49df7f8268f21acb0d8e271cbf32f /OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs | |
parent | change to floats where needed (diff) | |
download | opensim-SC_OLD-fea3c20576d195609dac1276344ce9c5252140d7.zip opensim-SC_OLD-fea3c20576d195609dac1276344ce9c5252140d7.tar.gz opensim-SC_OLD-fea3c20576d195609dac1276344ce9c5252140d7.tar.bz2 opensim-SC_OLD-fea3c20576d195609dac1276344ce9c5252140d7.tar.xz |
* renamed MySceneObject to CpuCounterObject
Diffstat (limited to 'OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs')
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs | 35 |
1 files changed, 35 insertions, 0 deletions
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 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim.Region.Environment.Scenes; | ||
5 | using libsecondlife; | ||
6 | using OpenSim.Framework.Types; | ||
7 | using System.Timers; | ||
8 | using System.Diagnostics; | ||
9 | |||
10 | namespace SimpleApp | ||
11 | { | ||
12 | public class CpuCounterObject : SceneObject | ||
13 | { | ||
14 | private PerformanceCounter m_counter; | ||
15 | |||
16 | public CpuCounterObject(Scene world, EventManager eventManager, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) | ||
17 | : base(world, eventManager, ownerID, localID, pos, shape ) | ||
18 | { | ||
19 | String objectName = "Processor"; | ||
20 | String counterName = "% Processor Time"; | ||
21 | String instanceName = "_Total"; | ||
22 | |||
23 | m_counter = new PerformanceCounter(objectName, counterName, instanceName); | ||
24 | } | ||
25 | |||
26 | public override void Update( ) | ||
27 | { | ||
28 | float cpu = m_counter.NextValue() / 40f; | ||
29 | LLVector3 size = new LLVector3(cpu, cpu, cpu); | ||
30 | rootPrimitive.ResizeGoup( size ); | ||
31 | |||
32 | base.Update(); | ||
33 | } | ||
34 | } | ||
35 | } | ||