Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

167 lines
6.0 KiB

  1. /*===================================================================
  2. Microsoft Denali
  3. Microsoft Confidential.
  4. Copyright 1996 Microsoft Corporation. All Rights Reserved.
  5. Component: ASP Status Html Dump
  6. File: htmldump.cpp
  7. Owner: dmitryr
  8. This file contains the ASP status html dump code
  9. used from IISPROBE.DLL
  10. ===================================================================*/
  11. #include "denpre.h"
  12. #pragma hdrstop
  13. #include "gip.h"
  14. #include "mtacb.h"
  15. #include "perfdata.h"
  16. #include "activdbg.h"
  17. #include "debugger.h"
  18. #include "dbgutil.h"
  19. #include "randgen.h"
  20. #include "aspdmon.h"
  21. #include "memcls.h"
  22. #include "memchk.h"
  23. /*===================================================================
  24. Helper classes and functions
  25. ===================================================================*/
  26. class CAspDump
  27. {
  28. private:
  29. char *m_szBuffer;
  30. DWORD m_dwMaxSize;
  31. DWORD m_dwActSize;
  32. public:
  33. CAspDump(char *szBuffer, DWORD dwMaxSize)
  34. {
  35. m_szBuffer = szBuffer;
  36. m_dwMaxSize = dwMaxSize;
  37. m_dwActSize = 0;
  38. }
  39. inline void __cdecl Dump(LPCSTR fmt, ...)
  40. {
  41. char szStr[512];
  42. va_list marker;
  43. va_start(marker, fmt);
  44. vsprintf(szStr, fmt, marker);
  45. va_end(marker);
  46. DWORD len = strlen(szStr);
  47. if (len > 0 && len < (m_dwMaxSize-m_dwActSize))
  48. {
  49. memcpy(m_szBuffer+m_dwActSize, szStr, len+1);
  50. m_dwActSize += len;
  51. }
  52. }
  53. DWORD GetSize()
  54. {
  55. return m_dwActSize;
  56. }
  57. };
  58. /*===================================================================
  59. AspStatusHtmlDump
  60. Function called from IISPROBE.DLL
  61. Fills in the buffer with the ASP status as HTML
  62. Parameters:
  63. szBuffer buffer to fill in
  64. pwdSize in - max buffer len
  65. out - actual buffer len filled
  66. Returns:
  67. TRUE
  68. ===================================================================*/
  69. extern "C"
  70. BOOL WINAPI AspStatusHtmlDump(char *szBuffer, DWORD *pdwSize)
  71. {
  72. CAspDump dump(szBuffer, *pdwSize);
  73. dump.Dump("<table border=1>\r\n");
  74. dump.Dump("<tr><td align=center colspan=2><b>Misc. Globals</b>\r\n");
  75. dump.Dump("<tr><td>fShutDownInProgress<td>%d\r\n", g_fShutDownInProgress);
  76. dump.Dump("<tr><td>nApplications<td>%d\r\n", g_nApplications);
  77. dump.Dump("<tr><td>nApplicationsRestarting<td>%d\r\n", g_nApplicationsRestarting);
  78. dump.Dump("<tr><td>nSessions<td>%d\r\n", g_nSessions);
  79. dump.Dump("<tr><td>nBrowserRequests<td>%d\r\n", g_nBrowserRequests);
  80. dump.Dump("<tr><td>nSessionCleanupRequests<td>%d\r\n", g_nSessionCleanupRequests);
  81. dump.Dump("<tr><td>nApplnCleanupRequests<td>%d\r\n", g_nApplnCleanupRequests);
  82. dump.Dump("<tr><td>pPDM (debugger)<td>%08p\r\n", g_pPDM);
  83. dump.Dump("<tr><td align=center colspan=2><b>Selected PerfMon Counters</b>\r\n");
  84. dump.Dump("<tr><td>Last request's execution time, ms<td>%d\r\n", *g_PerfData.PLCounter(ID_REQEXECTIME));
  85. dump.Dump("<tr><td>Last request's wait time, ms<td>%d\r\n", *g_PerfData.PLCounter(ID_REQWAITTIME));
  86. dump.Dump("<tr><td>Number of executing requests<td>%d\r\n", *g_PerfData.PLCounter(ID_REQBROWSEREXEC));
  87. dump.Dump("<tr><td>Number of requests waiting in the queue<td>%d\r\n", *g_PerfData.PLCounter(ID_REQCURRENT));
  88. dump.Dump("<tr><td>Number of rejected requests<td>%d\r\n", *g_PerfData.PLCounter(ID_REQREJECTED));
  89. dump.Dump("<tr><td>Total number of requests<td>%d\r\n", *g_PerfData.PLCounter(ID_REQTOTAL));
  90. dump.Dump("<tr><td>Last session's duration, ms<td>%d\r\n", *g_PerfData.PLCounter(ID_SESSIONLIFETIME));
  91. dump.Dump("<tr><td>Current number of sessions<td>%d\r\n", *g_PerfData.PLCounter(ID_SESSIONCURRENT));
  92. dump.Dump("<tr><td>Total number of sessions<td>%d\r\n", *g_PerfData.PLCounter(ID_SESSIONSTOTAL));
  93. dump.Dump("<tr><td>Number of cached templates<td>%d\r\n", *g_PerfData.PLCounter(ID_TEMPLCACHE));
  94. dump.Dump("<tr><td>Number of pending transactions<td>%d\r\n", *g_PerfData.PLCounter(ID_TRANSPENDING));
  95. dump.Dump("<tr><td align=center colspan=2><b>Applications</b>\r\n");
  96. CApplnIterator ApplnIterator;
  97. ApplnIterator.Start();
  98. CAppln *pAppln;
  99. while (pAppln = ApplnIterator.Next())
  100. {
  101. dump.Dump("<tr><td colspan=2>%08p\r\n", pAppln);
  102. dump.Dump("<tr><td align=right>metabase key<td>%s\r\n", pAppln->GetMetabaseKey());
  103. dump.Dump("<tr><td align=right>physical path<td>%s\r\n", pAppln->GetApplnPath(SOURCEPATHTYPE_PHYSICAL));
  104. dump.Dump("<tr><td align=right>virtual path<td>%s\r\n", pAppln->GetApplnPath(SOURCEPATHTYPE_VIRTUAL));
  105. dump.Dump("<tr><td align=right>number of sessions<td>%d\r\n", pAppln->GetNumSessions());
  106. dump.Dump("<tr><td align=right>number of requests<td>%d\r\n", pAppln->GetNumRequests());
  107. #if 0
  108. dump.Dump("<tr><td align=right>global.asa path<td>%s\r\n", pAppln->FHasGlobalAsa() ? pAppln->GetGlobalAsa() : "n/a");
  109. #endif
  110. dump.Dump("<tr><td align=right>global changed?<td>%d\r\n", pAppln->FGlobalChanged());
  111. dump.Dump("<tr><td align=right>tombstone?<td>%d\r\n", pAppln->FTombstone());
  112. dump.Dump("<tr><td align=right>debuggable?<td>%d\r\n", pAppln->FDebuggable());
  113. CSessionMgr *pSessionMgr = pAppln->PSessionMgr();
  114. dump.Dump("<tr><td align=right>session manager<td>%08p\r\n", pSessionMgr);
  115. if (pSessionMgr)
  116. {
  117. dump.Dump("<tr><td align=right>session killer scheduled?<td>%d\r\n", pSessionMgr->FIsSessionKillerScheduled());
  118. dump.Dump("<tr><td align=right>session cleanup requests<td>%d\r\n", pSessionMgr->GetNumSessionCleanupRequests());
  119. }
  120. else
  121. {
  122. }
  123. }
  124. ApplnIterator.Stop();
  125. dump.Dump("</table>\r\n");
  126. *pdwSize = dump.GetSize();
  127. return TRUE;
  128. }