fix build break on UserManagementModule.

This also adds time since started to "show threads".  Unfortunately these two changes got mixed in.
iar_mods
Justin Clark-Casey (justincc) 2011-11-15 23:24:51 +00:00
parent 5b9fe4497d
commit aea547cd11
3 changed files with 23 additions and 15 deletions

View File

@ -244,7 +244,7 @@ namespace OpenSim.Framework.Servers
protected string GetThreadsReport() protected string GetThreadsReport()
{ {
// This should be a constant field. // This should be a constant field.
string reportFormat = "{0,6} {1,35} {2,16} {3,10} {4,30}"; string reportFormat = "{0,6} {1,35} {2,16} {3,13} {4,10} {5,30}";
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreads(); Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreads();
@ -253,7 +253,7 @@ namespace OpenSim.Framework.Servers
int timeNow = Util.EnvironmentTickCount(); int timeNow = Util.EnvironmentTickCount();
sb.AppendFormat(reportFormat, "ID", "NAME", "LAST UPDATE (MS)", "PRIORITY", "STATE"); sb.AppendFormat(reportFormat, "ID", "NAME", "LAST UPDATE (MS)", "LIFETIME (MS)", "PRIORITY", "STATE");
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
foreach (Watchdog.ThreadWatchdogInfo twi in threads) foreach (Watchdog.ThreadWatchdogInfo twi in threads)
@ -262,8 +262,12 @@ namespace OpenSim.Framework.Servers
sb.AppendFormat( sb.AppendFormat(
reportFormat, reportFormat,
//t.ManagedThreadId, t.Name, string.Format("{0} ms", timeNow - twi.LastTick), t.Priority, t.ThreadState); t.ManagedThreadId,
t.ManagedThreadId, t.Name, timeNow - twi.LastTick, t.Priority, t.ThreadState); t.Name,
timeNow - twi.LastTick,
timeNow - twi.FirstTick,
t.Priority,
t.ThreadState);
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
} }

View File

@ -52,10 +52,13 @@ namespace OpenSim.Framework
/// <summary> /// <summary>
/// Approximate tick when this thread was started. /// Approximate tick when this thread was started.
/// </summary> /// </summary>
public int StartTick { get; private set; } /// <remarks>
/// Not terribly good since this quickly wraps around.
/// </remarks>
public int FirstTick { get; private set; }
/// <summary> /// <summary>
/// Last time this heartbeat update was invoked /// First time this heartbeat update was invoked
/// </summary> /// </summary>
public int LastTick { get; set; } public int LastTick { get; set; }
@ -73,8 +76,8 @@ namespace OpenSim.Framework
{ {
Thread = thread; Thread = thread;
Timeout = timeout; Timeout = timeout;
StartTick = Environment.TickCount & Int32.MaxValue; FirstTick = Environment.TickCount & Int32.MaxValue;
LastTick = StartTick; LastTick = FirstTick;
} }
} }

View File

@ -31,7 +31,6 @@ using System.Reflection;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Region.Framework; using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
@ -44,13 +43,13 @@ using Nini.Config;
namespace OpenSim.Region.CoreModules.Framework.UserManagement namespace OpenSim.Region.CoreModules.Framework.UserManagement
{ {
struct UserData class UserData
{ {
public UUID Id; public UUID Id { get; set; }
public string FirstName; public string FirstName { get; set; }
public string LastName; public string LastName { get; set; }
public string HomeURL; public string HomeURL { get; set; }
public Dictionary<string, object> ServerURLs; public Dictionary<string, object> ServerURLs { get; set; }
} }
public class UserManagementModule : ISharedRegionModule, IUserManagement public class UserManagementModule : ISharedRegionModule, IUserManagement
@ -253,6 +252,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
public string GetUserServerURL(UUID userID, string serverType) public string GetUserServerURL(UUID userID, string serverType)
{ {
UserData userdata;
lock (m_UserCache) lock (m_UserCache)
m_UserCache.TryGetValue(userID, out userdata); m_UserCache.TryGetValue(userID, out userdata);
@ -287,6 +287,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
if (account != null) if (account != null)
return userID.ToString(); return userID.ToString();
UserData ud;
lock (m_UserCache) lock (m_UserCache)
m_UserCache.TryGetValue(userID, out ud); m_UserCache.TryGetValue(userID, out ud);