aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs
diff options
context:
space:
mode:
authorlbsa712007-07-17 17:57:46 +0000
committerlbsa712007-07-17 17:57:46 +0000
commitfea3c20576d195609dac1276344ce9c5252140d7 (patch)
treedb0042c594c49df7f8268f21acb0d8e271cbf32f /OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs
parentchange to floats where needed (diff)
downloadopensim-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.cs35
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 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Region.Environment.Scenes;
5using libsecondlife;
6using OpenSim.Framework.Types;
7using System.Timers;
8using System.Diagnostics;
9
10namespace 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}