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.

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