| 1152 | } |
| 1153 | |
| 1154 | void HandleSystem::Dump(const HandleReporter &fn) |
| 1155 | { |
| 1156 | unsigned int total_size = 0; |
| 1157 | rep(fn, "%-10.10s\t%-20.20s\t%-20.20s\t%-10.10s\t%-30.30s", "Handle", "Owner", "Type", "Memory", "Time Created"); |
| 1158 | rep(fn, "---------------------------------------------------------------------------------------------"); |
| 1159 | |
| 1160 | const char *fmt = bridge->GetCvarString(g_datetime_format); |
| 1161 | for (unsigned int i = 1; i <= m_HandleTail; i++) |
| 1162 | { |
| 1163 | if (m_Handles[i].set != HandleSet_Used) |
| 1164 | { |
| 1165 | continue; |
| 1166 | } |
| 1167 | /* Get the index */ |
| 1168 | unsigned int index = (m_Handles[i].serial << HANDLESYS_HANDLE_BITS) | i; |
| 1169 | /* Determine the owner */ |
| 1170 | const char *owner = "UNKNOWN"; |
| 1171 | if (m_Handles[i].owner) |
| 1172 | { |
| 1173 | IdentityToken_t *pOwner = m_Handles[i].owner; |
| 1174 | if (pOwner == g_pCoreIdent) |
| 1175 | { |
| 1176 | owner = "CORE"; |
| 1177 | } |
| 1178 | else if (pOwner == scripts->GetIdentity()) |
| 1179 | { |
| 1180 | owner = "PLUGINSYS"; |
| 1181 | } |
| 1182 | else |
| 1183 | { |
| 1184 | IExtension *ext = g_Extensions.GetExtensionFromIdent(pOwner); |
| 1185 | if (ext) |
| 1186 | { |
| 1187 | owner = ext->GetFilename(); |
| 1188 | } |
| 1189 | else |
| 1190 | { |
| 1191 | SMPlugin *pPlugin = scripts->FindPluginByIdentity(pOwner); |
| 1192 | if (pPlugin) |
| 1193 | { |
| 1194 | owner = pPlugin->GetFilename(); |
| 1195 | } |
| 1196 | } |
| 1197 | } |
| 1198 | } |
| 1199 | else |
| 1200 | { |
| 1201 | owner = "NONE"; |
| 1202 | } |
| 1203 | const char *type = "ANON"; |
| 1204 | QHandleType *pType = &m_Types[m_Handles[i].type]; |
| 1205 | unsigned int size = 0; |
| 1206 | unsigned int parentIdx; |
| 1207 | bool bresult; |
| 1208 | if (pType->name) |
| 1209 | type = pType->name->c_str(); |
| 1210 | |
| 1211 | if ((parentIdx = m_Handles[i].clone) != 0) |
no test coverage detected