diff options
author | lbsa71 | 2007-07-14 16:01:10 +0000 |
---|---|---|
committer | lbsa71 | 2007-07-14 16:01:10 +0000 |
commit | eee1eb2f42cd848845dea56c0bf52abbb37d33b5 (patch) | |
tree | 2fcd9cd4a5ab75cc5cf6e7cd86f4ba68e7e70802 /OpenSim/Region | |
parent | *Added support for simwide area and simwide prim count for parcels (diff) | |
download | opensim-SC_OLD-eee1eb2f42cd848845dea56c0bf52abbb37d33b5.zip opensim-SC_OLD-eee1eb2f42cd848845dea56c0bf52abbb37d33b5.tar.gz opensim-SC_OLD-eee1eb2f42cd848845dea56c0bf52abbb37d33b5.tar.bz2 opensim-SC_OLD-eee1eb2f42cd848845dea56c0bf52abbb37d33b5.tar.xz |
* SimpleApp finally doing something fun. :)
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Examples/SimpleApp/MySceneObject.cs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs b/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs index 8508dac..1218dac 100644 --- a/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs +++ b/OpenSim/Region/Examples/SimpleApp/MySceneObject.cs | |||
@@ -5,35 +5,35 @@ using OpenSim.Region.Environment.Scenes; | |||
5 | using libsecondlife; | 5 | using libsecondlife; |
6 | using OpenSim.Framework.Types; | 6 | using OpenSim.Framework.Types; |
7 | using System.Timers; | 7 | using System.Timers; |
8 | using System.Diagnostics; | ||
8 | 9 | ||
9 | namespace SimpleApp | 10 | namespace SimpleApp |
10 | { | 11 | { |
11 | public class MySceneObject : SceneObject | 12 | public class MySceneObject : SceneObject |
12 | { | 13 | { |
13 | LLVector3 delta = new LLVector3(0.1f, 0.1f, 0.1f); | 14 | private PerformanceCounter m_counter; |
14 | 15 | ||
15 | public MySceneObject(Scene world, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) | 16 | public MySceneObject(Scene world, LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) |
16 | : base(world, ownerID, localID, pos, shape ) | 17 | : base(world, ownerID, localID, pos, shape ) |
17 | { | 18 | { |
19 | String objectName = "Processor"; | ||
20 | String counterName = "% Processor Time"; | ||
21 | String instanceName = "_Total"; | ||
22 | |||
23 | m_counter = new PerformanceCounter(objectName, counterName, instanceName); | ||
24 | |||
18 | Timer timer = new Timer(); | 25 | Timer timer = new Timer(); |
19 | timer.Enabled = true; | 26 | timer.Enabled = true; |
20 | timer.Interval = 100; | 27 | timer.Interval = 100; |
21 | timer.Elapsed += new ElapsedEventHandler(this.Heartbeat); | 28 | timer.Elapsed += new ElapsedEventHandler(this.Heartbeat); |
29 | |||
22 | } | 30 | } |
23 | 31 | ||
24 | public void Heartbeat(object sender, EventArgs e) | 32 | public void Heartbeat(object sender, EventArgs e) |
25 | { | 33 | { |
26 | if (rootPrimitive.Scale.X > 1) | 34 | float cpu = m_counter.NextValue() / 40f; |
27 | { | 35 | LLVector3 size = new LLVector3(cpu, cpu, cpu); |
28 | delta = new LLVector3(-0.1f, -0.1f, -0.1f); | 36 | rootPrimitive.ResizeGoup( size ); |
29 | } | ||
30 | |||
31 | if (rootPrimitive.Scale.X < 0.2f) | ||
32 | { | ||
33 | delta = new LLVector3(0.1f, 0.1f, 0.1f); | ||
34 | } | ||
35 | |||
36 | rootPrimitive.ResizeGoup(rootPrimitive.Scale + delta); | ||
37 | update(); | 37 | update(); |
38 | } | 38 | } |
39 | } | 39 | } |