aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-07-13 00:03:23 +0100
committerJustin Clark-Casey (justincc)2013-07-13 00:03:23 +0100
commitb4cb644a053d671861f5309930ce8f5551875b7a (patch)
treeed3d713200f61dee709a0457399d6e56a5b7a5db /OpenSim
parentIn co-op termination, extend EventWaitHandle to give this an indefinite lifet... (diff)
parentAdd ToOSDMap() overrides to the Stat subclass CounterStat. (diff)
downloadopensim-SC-b4cb644a053d671861f5309930ce8f5551875b7a.zip
opensim-SC-b4cb644a053d671861f5309930ce8f5551875b7a.tar.gz
opensim-SC-b4cb644a053d671861f5309930ce8f5551875b7a.tar.bz2
opensim-SC-b4cb644a053d671861f5309930ce8f5551875b7a.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Framework/Monitoring/Stats/CounterStat.cs21
-rw-r--r--OpenSim/Framework/Monitoring/Stats/Stat.cs1
-rw-r--r--OpenSim/Framework/Monitoring/StatsManager.cs66
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs35
-rw-r--r--OpenSim/Tests/Clients/Assets/AssetsClient.cs21
5 files changed, 134 insertions, 10 deletions
diff --git a/OpenSim/Framework/Monitoring/Stats/CounterStat.cs b/OpenSim/Framework/Monitoring/Stats/CounterStat.cs
index caea30d..04442c3 100755
--- a/OpenSim/Framework/Monitoring/Stats/CounterStat.cs
+++ b/OpenSim/Framework/Monitoring/Stats/CounterStat.cs
@@ -224,5 +224,26 @@ public class CounterStat : Stat
224 } 224 }
225 } 225 }
226 } 226 }
227
228 // CounterStat is a basic stat plus histograms
229 public override OSDMap ToOSDMap()
230 {
231 // Get the foundational instance
232 OSDMap map = base.ToOSDMap();
233
234 map["StatType"] = "CounterStat";
235
236 // If there are any histograms, add a new field that is an array of histograms as OSDMaps
237 if (m_histograms.Count > 0)
238 {
239 OSDArray histos = new OSDArray();
240 foreach (EventHistogram histo in m_histograms.Values)
241 {
242 histos.Add(histo.GetHistogramAsOSDMap());
243 }
244 map.Add("Histograms", histos);
245 }
246 return map;
247 }
227} 248}
228} 249}
diff --git a/OpenSim/Framework/Monitoring/Stats/Stat.cs b/OpenSim/Framework/Monitoring/Stats/Stat.cs
index c57ee0c..9629b6e 100644
--- a/OpenSim/Framework/Monitoring/Stats/Stat.cs
+++ b/OpenSim/Framework/Monitoring/Stats/Stat.cs
@@ -242,6 +242,7 @@ namespace OpenSim.Framework.Monitoring
242 ret.Add("Description", OSD.FromString(Description)); 242 ret.Add("Description", OSD.FromString(Description));
243 ret.Add("UnitName", OSD.FromString(UnitName)); 243 ret.Add("UnitName", OSD.FromString(UnitName));
244 ret.Add("Value", OSD.FromReal(Value)); 244 ret.Add("Value", OSD.FromReal(Value));
245 ret.Add("StatType", "Stat"); // used by overloading classes to denote type of stat
245 246
246 return ret; 247 return ret;
247 } 248 }
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index 12d3a75..a5b54c9 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -30,6 +30,8 @@ using System.Collections.Generic;
30using System.Linq; 30using System.Linq;
31using System.Text; 31using System.Text;
32 32
33using OpenMetaverse.StructuredData;
34
33namespace OpenSim.Framework.Monitoring 35namespace OpenSim.Framework.Monitoring
34{ 36{
35 /// <summary> 37 /// <summary>
@@ -168,6 +170,70 @@ namespace OpenSim.Framework.Monitoring
168 } 170 }
169 } 171 }
170 172
173 // Creates an OSDMap of the format:
174 // { categoryName: {
175 // containerName: {
176 // statName: {
177 // "Name": name,
178 // "ShortName": shortName,
179 // ...
180 // },
181 // statName: {
182 // "Name": name,
183 // "ShortName": shortName,
184 // ...
185 // },
186 // ...
187 // },
188 // containerName: {
189 // ...
190 // },
191 // ...
192 // },
193 // categoryName: {
194 // ...
195 // },
196 // ...
197 // }
198 // The passed in parameters will filter the categories, containers and stats returned. If any of the
199 // parameters are either EmptyOrNull or the AllSubCommand value, all of that type will be returned.
200 // Case matters.
201 public static OSDMap GetStatsAsOSDMap(string pCategoryName, string pContainerName, string pStatName)
202 {
203 OSDMap map = new OSDMap();
204
205 foreach (string catName in RegisteredStats.Keys)
206 {
207 // Do this category if null spec, "all" subcommand or category name matches passed parameter.
208 // Skip category if none of the above.
209 if (!(String.IsNullOrEmpty(pCategoryName) || pCategoryName == AllSubCommand || pCategoryName == catName))
210 continue;
211
212 OSDMap contMap = new OSDMap();
213 foreach (string contName in RegisteredStats[catName].Keys)
214 {
215 if (!(string.IsNullOrEmpty(pContainerName) || pContainerName == AllSubCommand || pContainerName == contName))
216 continue;
217
218 OSDMap statMap = new OSDMap();
219
220 SortedDictionary<string, Stat> theStats = RegisteredStats[catName][contName];
221 foreach (string statName in theStats.Keys)
222 {
223 if (!(String.IsNullOrEmpty(pStatName) || pStatName == AllSubCommand || pStatName == statName))
224 continue;
225
226 statMap.Add(statName, theStats[statName].ToOSDMap());
227 }
228
229 contMap.Add(contName, statMap);
230 }
231 map.Add(catName, contMap);
232 }
233
234 return map;
235 }
236
171// /// <summary> 237// /// <summary>
172// /// Start collecting statistics related to assets. 238// /// Start collecting statistics related to assets.
173// /// Should only be called once. 239// /// Should only be called once.
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
index 3b0ccd7..79a935d 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs
@@ -63,9 +63,16 @@ namespace OpenSim.Region.ClientStack.Linden
63 63
64 private Scene m_scene; 64 private Scene m_scene;
65 private bool m_persistBakedTextures; 65 private bool m_persistBakedTextures;
66 private string m_URL;
66 67
67 public void Initialise(IConfigSource source) 68 public void Initialise(IConfigSource source)
68 { 69 {
70 IConfig config = source.Configs["ClientStack.LindenCaps"];
71 if (config == null)
72 return;
73
74 m_URL = config.GetString("Cap_UploadBakedTexture", string.Empty);
75
69 IConfig appearanceConfig = source.Configs["Appearance"]; 76 IConfig appearanceConfig = source.Configs["Appearance"];
70 if (appearanceConfig != null) 77 if (appearanceConfig != null)
71 m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures); 78 m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures);
@@ -100,15 +107,27 @@ namespace OpenSim.Region.ClientStack.Linden
100 107
101 public void RegisterCaps(UUID agentID, Caps caps) 108 public void RegisterCaps(UUID agentID, Caps caps)
102 { 109 {
103 caps.RegisterHandler( 110 UUID capID = UUID.Random();
104 "UploadBakedTexture", 111
105 new RestStreamHandler( 112 //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
106 "POST", 113 if (m_URL == "localhost")
107 "/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath, 114 {
108 new UploadBakedTextureHandler( 115 caps.RegisterHandler(
109 caps, m_scene.AssetService, m_persistBakedTextures).UploadBakedTexture,
110 "UploadBakedTexture", 116 "UploadBakedTexture",
111 agentID.ToString())); 117 new RestStreamHandler(
118 "POST",
119 "/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath,
120 new UploadBakedTextureHandler(
121 caps, m_scene.AssetService, m_persistBakedTextures).UploadBakedTexture,
122 "UploadBakedTexture",
123 agentID.ToString()));
124
125 }
126 else
127 {
128 caps.RegisterHandler("UploadBakedTexture", m_URL);
129 }
130
112 } 131 }
113 } 132 }
114} \ No newline at end of file 133} \ No newline at end of file
diff --git a/OpenSim/Tests/Clients/Assets/AssetsClient.cs b/OpenSim/Tests/Clients/Assets/AssetsClient.cs
index dd168a1..26d740b 100644
--- a/OpenSim/Tests/Clients/Assets/AssetsClient.cs
+++ b/OpenSim/Tests/Clients/Assets/AssetsClient.cs
@@ -82,7 +82,16 @@ namespace OpenSim.Tests.Clients.AssetsClient
82 m_log.InfoFormat("[ASSET CLIENT]: [{0}] requested asset {1}", i, uuid); 82 m_log.InfoFormat("[ASSET CLIENT]: [{0}] requested asset {1}", i, uuid);
83 } 83 }
84 84
85 Thread.Sleep(20 * 1000); 85 for (int i = 0; i < 500; i++)
86 {
87 var x = i;
88 ThreadPool.QueueUserWorkItem(delegate
89 {
90 Dummy(x);
91 });
92 }
93
94 Thread.Sleep(30 * 1000);
86 m_log.InfoFormat("[ASSET CLIENT]: Received responses {0}", m_NReceived); 95 m_log.InfoFormat("[ASSET CLIENT]: Received responses {0}", m_NReceived);
87 } 96 }
88 97
@@ -92,8 +101,16 @@ namespace OpenSim.Tests.Clients.AssetsClient
92 m_MaxThreadID = Thread.CurrentThread.ManagedThreadId; 101 m_MaxThreadID = Thread.CurrentThread.ManagedThreadId;
93 int max1, max2; 102 int max1, max2;
94 ThreadPool.GetAvailableThreads(out max1, out max2); 103 ThreadPool.GetAvailableThreads(out max1, out max2);
95 m_log.InfoFormat("[ASSET CLIENT]: Received asset {0} ({1}) ({2}-{3})", id, m_MaxThreadID, max1, max2); 104 m_log.InfoFormat("[ASSET CLIENT]: Received asset {0} ({1}) ({2}-{3}) {4}", id, m_MaxThreadID, max1, max2, DateTime.Now.ToString("hh:mm:ss"));
96 m_NReceived++; 105 m_NReceived++;
97 } 106 }
107
108 private static void Dummy(int i)
109 {
110 int max1, max2;
111 ThreadPool.GetAvailableThreads(out max1, out max2);
112 m_log.InfoFormat("[ASSET CLIENT]: ({0}) Hello! {1} - {2} {3}", i, max1, max2, DateTime.Now.ToString("hh:mm:ss"));
113 Thread.Sleep(2000);
114 }
98 } 115 }
99} 116}