aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/UserStatistics
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/UserStatistics')
-rw-r--r--OpenSim/Region/UserStatistics/WebStatsModule.cs84
1 files changed, 7 insertions, 77 deletions
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index cc041d1..a00955a 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -575,7 +575,7 @@ namespace OpenSim.Region.UserStatistics
575 575
576 lock (db) 576 lock (db)
577 { 577 {
578 using (SqliteCommand updatecmd = new SqliteCommand(SQL_STATS_TABLE_UPDATE, db)) 578 using (SqliteCommand updatecmd = new SqliteCommand(SQL_STATS_TABLE_INSERT, db))
579 { 579 {
580 updatecmd.Parameters.Add(new SqliteParameter(":session_id", uid.session_data.session_id.ToString())); 580 updatecmd.Parameters.Add(new SqliteParameter(":session_id", uid.session_data.session_id.ToString()));
581 updatecmd.Parameters.Add(new SqliteParameter(":agent_id", uid.session_data.agent_id.ToString())); 581 updatecmd.Parameters.Add(new SqliteParameter(":agent_id", uid.session_data.agent_id.ToString()));
@@ -624,22 +624,9 @@ namespace OpenSim.Region.UserStatistics
624 updatecmd.Parameters.Add(new SqliteParameter(":f_dropped", uid.session_data.f_dropped)); 624 updatecmd.Parameters.Add(new SqliteParameter(":f_dropped", uid.session_data.f_dropped));
625 updatecmd.Parameters.Add(new SqliteParameter(":f_failed_resends", uid.session_data.f_failed_resends)); 625 updatecmd.Parameters.Add(new SqliteParameter(":f_failed_resends", uid.session_data.f_failed_resends));
626 updatecmd.Parameters.Add(new SqliteParameter(":f_invalid", uid.session_data.f_invalid)); 626 updatecmd.Parameters.Add(new SqliteParameter(":f_invalid", uid.session_data.f_invalid));
627
628 updatecmd.Parameters.Add(new SqliteParameter(":f_off_circuit", uid.session_data.f_off_circuit)); 627 updatecmd.Parameters.Add(new SqliteParameter(":f_off_circuit", uid.session_data.f_off_circuit));
629 updatecmd.Parameters.Add(new SqliteParameter(":f_resent", uid.session_data.f_resent)); 628 updatecmd.Parameters.Add(new SqliteParameter(":f_resent", uid.session_data.f_resent));
630 updatecmd.Parameters.Add(new SqliteParameter(":f_send_packet", uid.session_data.f_send_packet)); 629 updatecmd.Parameters.Add(new SqliteParameter(":f_send_packet", uid.session_data.f_send_packet));
631
632 updatecmd.Parameters.Add(new SqliteParameter(":session_key", uid.session_data.session_id.ToString()));
633
634// m_log.DebugFormat("[WEB STATS MODULE]: Database stats update for {0}", uid.session_data.agent_id);
635
636 int result = updatecmd.ExecuteNonQuery();
637
638 if (result == 0)
639 {
640// m_log.DebugFormat("[WEB STATS MODULE]: Database stats insert for {0}", uid.session_data.agent_id);
641
642 updatecmd.CommandText = SQL_STATS_TABLE_INSERT;
643 630
644// StringBuilder parameters = new StringBuilder(); 631// StringBuilder parameters = new StringBuilder();
645// SqliteParameterCollection spc = updatecmd.Parameters; 632// SqliteParameterCollection spc = updatecmd.Parameters;
@@ -648,17 +635,9 @@ namespace OpenSim.Region.UserStatistics
648// 635//
649// m_log.DebugFormat("[WEB STATS MODULE]: Parameters {0}", parameters); 636// m_log.DebugFormat("[WEB STATS MODULE]: Parameters {0}", parameters);
650 637
651 try 638// m_log.DebugFormat("[WEB STATS MODULE]: Database stats update for {0}", uid.session_data.agent_id);
652 { 639
653 updatecmd.ExecuteNonQuery(); 640 updatecmd.ExecuteNonQuery();
654 }
655 catch (SqliteExecutionException e)
656 {
657 m_log.WarnFormat(
658 "[WEB STATS MODULE]: failed to write stats for {0}, storage Execution Exception {1}{2}",
659 uid.session_data.agent_id, e.Message, e.StackTrace);
660 }
661 }
662 } 641 }
663 } 642 }
664 } 643 }
@@ -714,7 +693,7 @@ namespace OpenSim.Region.UserStatistics
714 f_send_packet INT NOT NULL DEFAULT '0' 693 f_send_packet INT NOT NULL DEFAULT '0'
715 );"; 694 );";
716 695
717 private const string SQL_STATS_TABLE_INSERT = @"INSERT INTO stats_session_data ( 696 private const string SQL_STATS_TABLE_INSERT = @"INSERT OR REPLACE INTO stats_session_data (
718session_id, agent_id, region_id, last_updated, remote_ip, name_f, name_l, avg_agents_in_view, min_agents_in_view, max_agents_in_view, 697session_id, agent_id, region_id, last_updated, remote_ip, name_f, name_l, avg_agents_in_view, min_agents_in_view, max_agents_in_view,
719mode_agents_in_view, avg_fps, min_fps, max_fps, mode_fps, a_language, mem_use, meters_traveled, avg_ping, min_ping, max_ping, mode_ping, 698mode_agents_in_view, avg_fps, min_fps, max_fps, mode_fps, a_language, mem_use, meters_traveled, avg_ping, min_ping, max_ping, mode_ping,
720regions_visited, run_time, avg_sim_fps, min_sim_fps, max_sim_fps, mode_sim_fps, start_time, client_version, s_cpu, s_gpu, s_os, s_ram, 699regions_visited, run_time, avg_sim_fps, min_sim_fps, max_sim_fps, mode_sim_fps, start_time, client_version, s_cpu, s_gpu, s_os, s_ram,
@@ -731,59 +710,10 @@ VALUES
731) 710)
732"; 711";
733 712
734 private const string SQL_STATS_TABLE_UPDATE = @"
735UPDATE stats_session_data
736set session_id=:session_id,
737 agent_id=:agent_id,
738 region_id=:region_id,
739 last_updated=:last_updated,
740 remote_ip=:remote_ip,
741 name_f=:name_f,
742 name_l=:name_l,
743 avg_agents_in_view=:avg_agents_in_view,
744 min_agents_in_view=:min_agents_in_view,
745 max_agents_in_view=:max_agents_in_view,
746 mode_agents_in_view=:mode_agents_in_view,
747 avg_fps=:avg_fps,
748 min_fps=:min_fps,
749 max_fps=:max_fps,
750 mode_fps=:mode_fps,
751 a_language=:a_language,
752 mem_use=:mem_use,
753 meters_traveled=:meters_traveled,
754 avg_ping=:avg_ping,
755 min_ping=:min_ping,
756 max_ping=:max_ping,
757 mode_ping=:mode_ping,
758 regions_visited=:regions_visited,
759 run_time=:run_time,
760 avg_sim_fps=:avg_sim_fps,
761 min_sim_fps=:min_sim_fps,
762 max_sim_fps=:max_sim_fps,
763 mode_sim_fps=:mode_sim_fps,
764 start_time=:start_time,
765 client_version=:client_version,
766 s_cpu=:s_cpu,
767 s_gpu=:s_gpu,
768 s_os=:s_os,
769 s_ram=:s_ram,
770 d_object_kb=:d_object_kb,
771 d_texture_kb=:d_texture_kb,
772 d_world_kb=:d_world_kb,
773 n_in_kb=:n_in_kb,
774 n_in_pk=:n_in_pk,
775 n_out_kb=:n_out_kb,
776 n_out_pk=:n_out_pk,
777 f_dropped=:f_dropped,
778 f_failed_resends=:f_failed_resends,
779 f_invalid=:f_invalid,
780 f_off_circuit=:f_off_circuit,
781 f_resent=:f_resent,
782 f_send_packet=:f_send_packet
783WHERE session_id=:session_key";
784 }
785 #endregion 713 #endregion
786 714
715 }
716
787 public static class UserSessionUtil 717 public static class UserSessionUtil
788 { 718 {
789 public static UserSessionData newUserSessionData() 719 public static UserSessionData newUserSessionData()