|
5 | 5 | #include "sendvw.h"
|
6 | 6 | #include "Color.h"
|
7 | 7 |
|
| 8 | +#include "png/png.h" // for version |
| 9 | + |
8 | 10 | // my debugging
|
9 | 11 |
|
10 | 12 | // memory state tracking
|
@@ -841,6 +843,310 @@ VARIANT CMUSHclientDoc::Debug(LPCTSTR Command)
|
841 | 843 | Note (TFormat ("%i info item%s.", PLURAL (iCount)));
|
842 | 844 |
|
843 | 845 | } // end of info
|
| 846 | +//----------------------------------------------------------------------- |
| 847 | +// summary |
| 848 | +//----------------------------------------------------------------------- |
| 849 | + else if (strcmp (Command, "summary") == 0) |
| 850 | + { |
| 851 | + |
| 852 | + Note (""); |
| 853 | + Note ("-------------- MUSHclient summary --------------"); |
| 854 | + Note (""); |
| 855 | + Note (TFormat ("MUSHclient version: %s", MUSHCLIENT_VERSION)); |
| 856 | + // show compilation date |
| 857 | + Note (TFormat ("Compiled: %s.", __DATE__)); |
| 858 | + |
| 859 | + OSVERSIONINFO ver; |
| 860 | + // see which OS we are using |
| 861 | + memset(&ver, 0, sizeof(ver)); |
| 862 | + ver.dwOSVersionInfoSize = sizeof(ver); |
| 863 | + ::GetVersionEx (&ver); |
| 864 | + |
| 865 | + // work out operating system |
| 866 | + |
| 867 | + char * sVersion = "unknown"; |
| 868 | + |
| 869 | + if (ver.dwPlatformId == 1) // Windows 95-style versions |
| 870 | + { |
| 871 | + switch (ver.dwMinorVersion) |
| 872 | + { |
| 873 | + case 0: sVersion = "Windows 95"; break; |
| 874 | + case 10: sVersion = "Windows 98"; break; |
| 875 | + case 90: sVersion = "Windows ME"; break; |
| 876 | + } // end of switch on dwMinorVersion |
| 877 | + } // end of dwPlatformId == 1 |
| 878 | + else if (ver.dwPlatformId == 2) // Windows NT versions |
| 879 | + { |
| 880 | + switch (ver.dwMajorVersion) |
| 881 | + { |
| 882 | + case 3: sVersion = "Windows NT 3.51"; break; |
| 883 | + case 4: sVersion = "Windows NT"; break; |
| 884 | + case 5: |
| 885 | + switch (ver.dwMinorVersion) |
| 886 | + { |
| 887 | + case 0: sVersion = "Windows 2000"; break; |
| 888 | + case 1: sVersion = "Windows XP"; break; |
| 889 | + case 2: sVersion = "Windows Server 2003"; break; |
| 890 | + } // end of switch on dwMinorVersion |
| 891 | + break; // end case 5 of dwMinorVersion |
| 892 | + |
| 893 | + case 6: |
| 894 | + switch (ver.dwMinorVersion) |
| 895 | + { |
| 896 | + case 0: sVersion = "Windows Vista"; break; |
| 897 | + case 1: sVersion = "Windows 7"; break; |
| 898 | + } // end of switch on dwMinorVersion |
| 899 | + break; // end case 6 of dwMinorVersion |
| 900 | + |
| 901 | + } // end of switch on dwMajorVersion |
| 902 | + } // end of dwPlatformId == 2 |
| 903 | + |
| 904 | + |
| 905 | + Note (TFormat ("Operating system: %s", sVersion)); |
| 906 | + |
| 907 | + |
| 908 | + // show included library versions |
| 909 | + Note (TFormat ("Using: %s, PCRE %s, PNG %s, SQLite3 %s, Zlib %s", |
| 910 | + LUA_RELEASE, |
| 911 | + XSTRING(PCRE_MAJOR.PCRE_MINOR), |
| 912 | + PNG_LIBPNG_VER_STRING, |
| 913 | + SQLITE_VERSION, |
| 914 | + ZLIB_VERSION)); |
| 915 | + |
| 916 | + |
| 917 | + // scripting info |
| 918 | + |
| 919 | + Note (TFormat ("Script language: %s, enabled: %s", |
| 920 | + (LPCTSTR) m_strLanguage, |
| 921 | + (m_bEnableScripts ? "yes" : "no"))); |
| 922 | + Note (TFormat ("Scripting active: %s", |
| 923 | + (GetScriptEngine () ? "yes" : "no"))); |
| 924 | + if (!m_strScriptFilename.IsEmpty ()) |
| 925 | + Note (TFormat ("Script file: %s", |
| 926 | + (LPCTSTR) m_strScriptFilename |
| 927 | + )); |
| 928 | + |
| 929 | + |
| 930 | + // count triggers, aliases, timers |
| 931 | + |
| 932 | + |
| 933 | + POSITION pos; |
| 934 | + CString strName; |
| 935 | + CTrigger * pTrigger; |
| 936 | + CAlias * pAlias; |
| 937 | + CTimer * pTimer; |
| 938 | + CPlugin * pPlugin; |
| 939 | + |
| 940 | + __int64 nTotalMatches = 0; |
| 941 | + __int64 nTotalMatchAttempts = 0; |
| 942 | + long nTotal = 0; |
| 943 | + long nEnabled = 0; |
| 944 | + long nRegexp = 0; |
| 945 | + LONGLONG iTimeTaken = 0; |
| 946 | + double elapsed_time; |
| 947 | + |
| 948 | + |
| 949 | + // count number of triggers matched |
| 950 | + for (pos = m_TriggerMap.GetStartPosition(); pos; ) |
| 951 | + { |
| 952 | + m_TriggerMap.GetNextAssoc (pos, strName, pTrigger); |
| 953 | + nTotal++; |
| 954 | + |
| 955 | + if (pTrigger->regexp) |
| 956 | + { |
| 957 | + iTimeTaken += pTrigger->regexp->iTimeTaken; |
| 958 | + nTotalMatchAttempts += pTrigger->regexp->m_iMatchAttempts; |
| 959 | + } |
| 960 | + |
| 961 | + nTotalMatches += pTrigger->nMatched; |
| 962 | + |
| 963 | + if (pTrigger->bRegexp) |
| 964 | + nRegexp++; |
| 965 | + |
| 966 | + if (pTrigger->bEnabled) |
| 967 | + nEnabled++; |
| 968 | + } |
| 969 | + |
| 970 | + // time taken to execute triggers |
| 971 | + if (App.m_iCounterFrequency > 0) |
| 972 | + { |
| 973 | + elapsed_time = ((double) iTimeTaken) / |
| 974 | + ((double) App.m_iCounterFrequency); |
| 975 | + } |
| 976 | + else |
| 977 | + elapsed_time = 0; |
| 978 | + |
| 979 | + Note (TFormat ("** Triggers: %ld in world file, triggers enabled: %s.", |
| 980 | + nTotal, |
| 981 | + (m_enable_triggers ? "yes" : "no"))); |
| 982 | + Note (TFormat (" %ld enabled, %ld regexp, %I64d attempts, %I64d matched, %1.6f seconds.", |
| 983 | + nEnabled, nRegexp, nTotalMatchAttempts, nTotalMatches, elapsed_time)); |
| 984 | + |
| 985 | + |
| 986 | + nTotalMatches = 0; |
| 987 | + nTotalMatchAttempts = 0; |
| 988 | + nTotal = 0; |
| 989 | + nEnabled = 0; |
| 990 | + nRegexp = 0; |
| 991 | + iTimeTaken = 0; |
| 992 | + elapsed_time; |
| 993 | + |
| 994 | + // count number of aliases matched |
| 995 | + for (pos = m_AliasMap.GetStartPosition(); pos; ) |
| 996 | + { |
| 997 | + m_AliasMap.GetNextAssoc (pos, strName, pAlias); |
| 998 | + nTotal++; |
| 999 | + |
| 1000 | + if (pAlias->regexp) |
| 1001 | + { |
| 1002 | + iTimeTaken += pAlias->regexp->iTimeTaken; |
| 1003 | + nTotalMatchAttempts += pAlias->regexp->m_iMatchAttempts; |
| 1004 | + } |
| 1005 | + |
| 1006 | + nTotalMatches += pAlias->nMatched; |
| 1007 | + if (pAlias->bRegexp) |
| 1008 | + nRegexp++; |
| 1009 | + |
| 1010 | + if (pAlias->bEnabled) |
| 1011 | + nEnabled++; |
| 1012 | + } |
| 1013 | + |
| 1014 | + // time taken to execute aliases |
| 1015 | + if (App.m_iCounterFrequency > 0) |
| 1016 | + { |
| 1017 | + elapsed_time = ((double) iTimeTaken) / |
| 1018 | + ((double) App.m_iCounterFrequency); |
| 1019 | + } |
| 1020 | + else |
| 1021 | + elapsed_time = 0; |
| 1022 | + |
| 1023 | + Note (TFormat ("** Aliases: %ld in world file, aliases enabled: %s.", |
| 1024 | + nTotal, |
| 1025 | + (m_enable_aliases ? "yes" : "no"))); |
| 1026 | + Note (TFormat (" %ld enabled, %ld regexp, %I64d attempts, %I64d matched, %1.6f seconds.", |
| 1027 | + nEnabled, nRegexp, nTotalMatchAttempts, nTotalMatches, elapsed_time)); |
| 1028 | + |
| 1029 | + nTotalMatches = 0; |
| 1030 | + nTotal = 0; |
| 1031 | + nEnabled = 0; |
| 1032 | + |
| 1033 | + // count number of timers fired |
| 1034 | + for (pos = m_TimerMap.GetStartPosition(); pos; ) |
| 1035 | + { |
| 1036 | + m_TimerMap.GetNextAssoc (pos, strName, pTimer); |
| 1037 | + nTotal++; |
| 1038 | + |
| 1039 | + nTotalMatches += pTimer->nMatched; |
| 1040 | + |
| 1041 | + if (pTimer->bEnabled) |
| 1042 | + nEnabled++; |
| 1043 | + } |
| 1044 | + |
| 1045 | + |
| 1046 | + Note (TFormat ("** Timers: %ld in world file, timers enabled: %s.", |
| 1047 | + nTotal, |
| 1048 | + (m_bEnableTimers ? "yes" : "no"))); |
| 1049 | + Note (TFormat (" %ld enabled, %I64d fired.", |
| 1050 | + nEnabled, nTotalMatches)); |
| 1051 | + |
| 1052 | + // time taken to do MCCP |
| 1053 | + if (App.m_iCounterFrequency > 0) |
| 1054 | + { |
| 1055 | + elapsed_time = ((double) m_iCompressionTimeTaken) / |
| 1056 | + ((double) App.m_iCounterFrequency); |
| 1057 | + } |
| 1058 | + else |
| 1059 | + elapsed_time = 0; |
| 1060 | + |
| 1061 | + |
| 1062 | + nTotal = 0; |
| 1063 | + |
| 1064 | + for (pos = GetVariableMap ().GetStartPosition(); pos; nTotal++) |
| 1065 | + { |
| 1066 | + CString strVariableName; |
| 1067 | + CVariable * variable_item; |
| 1068 | + |
| 1069 | + GetVariableMap ().GetNextAssoc (pos, strVariableName, variable_item); |
| 1070 | + } |
| 1071 | + |
| 1072 | + Note (TFormat ("** Variables: %ld.", nTotal)); |
| 1073 | + |
| 1074 | + if (m_bCompress) |
| 1075 | + Note (TFormat ("MCCP active, took %1.6f seconds to decompress", elapsed_time)); |
| 1076 | + else |
| 1077 | + Note (Translate ("MCCP not active.")); |
| 1078 | + |
| 1079 | + |
| 1080 | + // count and display plugins |
| 1081 | + |
| 1082 | + nTotal = 0; |
| 1083 | + nEnabled = 0; |
| 1084 | + |
| 1085 | + for (pos = m_PluginList.GetHeadPosition (); pos; iCount++) |
| 1086 | + { |
| 1087 | + pPlugin = m_PluginList.GetNext (pos); |
| 1088 | + nTotal++; |
| 1089 | + Note (TFormat ("Plugin: %s, '%s', enabled: %s", |
| 1090 | + (LPCTSTR) pPlugin->m_strID, |
| 1091 | + (LPCTSTR) pPlugin->m_strName, |
| 1092 | + (pPlugin->m_bEnabled ? "yes" : "no"))); |
| 1093 | + |
| 1094 | + if (pPlugin->m_bEnabled) |
| 1095 | + nEnabled++; |
| 1096 | + |
| 1097 | + } |
| 1098 | + |
| 1099 | + Note (TFormat ("** Plugins: %ld loaded, %ld enabled.", nTotal, nEnabled)); |
| 1100 | + |
| 1101 | + // show bytes sent/received |
| 1102 | + |
| 1103 | + __int64 nInK = m_nBytesIn / (__int64) 1024; |
| 1104 | + __int64 nOutK = m_nBytesOut / (__int64) 1024; |
| 1105 | + Note (TFormat ("Received: %I64d bytes (%I64d Kb)", m_nBytesIn, nInK)); |
| 1106 | + Note (TFormat ("Sent: %I64d bytes (%I64d Kb)", m_nBytesOut, nOutK)); |
| 1107 | + |
| 1108 | + Note (TFormat ("Output buffer: %i of %ld lines.", |
| 1109 | + m_LineList.GetCount (), |
| 1110 | + m_maxlines)); |
| 1111 | + |
| 1112 | + Note (TFormat ("Total lines received: %ld", m_total_lines)); |
| 1113 | + |
| 1114 | + //MXP |
| 1115 | + |
| 1116 | + Note (TFormat ("MXP active: %s, Pueblo mode: %s", |
| 1117 | + (m_bMXP ? "yes" : "no"), |
| 1118 | + (m_bPuebloActive ? "yes" : "no") )); |
| 1119 | + |
| 1120 | + Note (TFormat ("MXP tags received: %I64d", m_iMXPtags)); |
| 1121 | + Note (TFormat ("MXP entities received: %I64d", m_iMXPentities)); |
| 1122 | + Note (TFormat ("MXP errors: %I64d", m_iMXPerrors)); |
| 1123 | + |
| 1124 | + |
| 1125 | + // commands typed |
| 1126 | + |
| 1127 | + nTotal = 0; |
| 1128 | + |
| 1129 | + for(pos = GetFirstViewPosition(); pos != NULL; ) |
| 1130 | + { |
| 1131 | + CView* pView = GetNextView(pos); |
| 1132 | + |
| 1133 | + if (pView->IsKindOf(RUNTIME_CLASS(CSendView))) |
| 1134 | + { |
| 1135 | + CSendView* pmyView = (CSendView*)pView; |
| 1136 | + |
| 1137 | + for (POSITION pos = pmyView->m_msgList.GetHeadPosition(); pos; nTotal++) |
| 1138 | + pmyView->m_msgList.GetNext (pos); |
| 1139 | + |
| 1140 | + } // end of being a CSendView |
| 1141 | + } // end of loop through views |
| 1142 | + |
| 1143 | + Note (TFormat ("** Commands in command history: %ld", nTotal)); |
| 1144 | + |
| 1145 | + Note (""); |
| 1146 | + Note ("-------------- End summary --------------"); |
| 1147 | + |
| 1148 | + } // end of summary |
| 1149 | + |
844 | 1150 | #ifdef PANE
|
845 | 1151 | //-----------------------------------------------------------------------
|
846 | 1152 | // panes
|
@@ -924,6 +1230,7 @@ VARIANT CMUSHclientDoc::Debug(LPCTSTR Command)
|
924 | 1230 | Note ("plugins");
|
925 | 1231 | Note ("server_elements");
|
926 | 1232 | Note ("server_entities");
|
| 1233 | + Note ("summary"); |
927 | 1234 | Note ("triggers");
|
928 | 1235 | Note ("variables");
|
929 | 1236 | } // end of invalid/none entered
|
|
0 commit comments