Changeset 2968 in kBuild
- Timestamp:
- Sep 26, 2016 6:14:50 PM (8 years ago)
- Location:
- trunk/src/kWorker
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kWorker/Makefile.kmk
r2948 r2968 77 77 nt/ntunlink.c \ 78 78 nt/kFsCache.c \ 79 quote_argv.c 79 quote_argv.c \ 80 maybe_con_write.c \ 81 maybe_con_fwrite.c \ 82 msc_buffered_printf.c 80 83 kbuild_version.c_DEFS = KBUILD_SVN_REV=$(KBUILD_SVN_REV) 81 84 -
trunk/src/kWorker/kWorker.c
r2965 r2968 44 44 #include <ctype.h> 45 45 #include <errno.h> 46 #include <process.h> 46 47 47 48 #include "nt/ntstat.h" … … 977 978 978 979 980 /** Number of jobs executed. */ 981 static KU32 g_cJobs; 982 /** Number of tools. */ 983 static KU32 g_cTools; 984 /** Number of modules. */ 985 static KU32 g_cModules; 986 /** Number of non-native modules. */ 987 static KU32 g_cNonNativeModules; 988 989 990 979 991 /********************************************************************************************************************************* 980 992 * Internal Functions * … … 1818 1830 KW_LOG(("New module: %p LB %#010x %s (native)\n", 1819 1831 (KUPTR)pMod->pLdrMod->aSegments[0].MapAddress, kLdrModSize(pMod->pLdrMod), pMod->pszPath)); 1832 g_cModules++; 1820 1833 return kwLdrModuleLink(pMod); 1821 1834 } … … 2124 2137 pMod->u.Manual.pvBits = pMod->u.Manual.pbCopy; 2125 2138 pMod->u.Manual.enmState = KWMODSTATE_NEEDS_BITS; 2139 g_cModules++; 2140 g_cNonNativeModules++; 2126 2141 return pMod; 2127 2142 } … … 2834 2849 2835 2850 kFsCacheObjRelease(g_pFsCache, pToolFsObj); 2851 g_cTools++; 2836 2852 return pTool; 2837 2853 } … … 9697 9713 } 9698 9714 #endif 9715 g_cJobs++; 9699 9716 9700 9717 /* … … 10037 10054 10038 10055 /** 10056 * Prints statistics. 10057 */ 10058 static void kwPrintStats(void) 10059 { 10060 PROCESS_MEMORY_COUNTERS_EX MemInfo; 10061 MEMORYSTATUSEX MemStatus; 10062 IO_COUNTERS IoCounters; 10063 DWORD cHandles; 10064 KSIZE cMisses; 10065 char szBuf[16*1024]; 10066 int off = 0; 10067 char szPrf[24]; 10068 extern size_t maybe_con_fwrite(void const *pvBuf, size_t cbUnit, size_t cUnits, FILE *pFile); 10069 10070 sprintf(szPrf, "%5d/%u:", getpid(), K_ARCH_BITS); 10071 10072 szBuf[off++] = '\n'; 10073 10074 off += sprintf(&szBuf[off], "%s %10" KU32_PRI " jobs, %" KU32_PRI" tools, %" KU32_PRI " modules, %" KU32_PRI" non-native ones\n", 10075 szPrf, g_cJobs, g_cTools, g_cModules, g_cNonNativeModules); 10076 10077 off += sprintf(&szBuf[off], "%s %10" KSIZE_PRI_U " bytes for the cache\n", 10078 szPrf, g_pFsCache->cbObjects + g_pFsCache->cbAnsiPaths + g_pFsCache->cbUtf16Paths + sizeof(*g_pFsCache)); 10079 off += sprintf(&szBuf[off], "%s %10" KSIZE_PRI_U " objects, taking up %" KSIZE_PRI_U " bytes, avg %" KSIZE_PRI_U " bytes\n", 10080 szPrf, g_pFsCache->cObjects, g_pFsCache->cbObjects, 10081 g_pFsCache->cbObjects / g_pFsCache->cObjects); 10082 off += sprintf(&szBuf[off], "%s %10" KSIZE_PRI_U " A path hashes, taking up %" KSIZE_PRI_U " bytes, avg %" KSIZE_PRI_U " bytes, %" KSIZE_PRI_U " collision\n", 10083 szPrf, g_pFsCache->cAnsiPaths, g_pFsCache->cbAnsiPaths, 10084 g_pFsCache->cbAnsiPaths / K_MAX(g_pFsCache->cAnsiPaths, 1), g_pFsCache->cAnsiPathCollisions); 10085 #ifdef KFSCACHE_CFG_UTF16 10086 off += sprintf(&szBuf[off], "%s %10" KSIZE_PRI_U " W path hashes, taking up %" KSIZE_PRI_U " bytes, avg %" KSIZE_PRI_U " bytes, %" KSIZE_PRI_U " collisions\n", 10087 szPrf, g_pFsCache->cUtf16Paths, g_pFsCache->cbUtf16Paths, 10088 g_pFsCache->cbUtf16Paths / K_MAX(g_pFsCache->cUtf16Paths, 1), g_pFsCache->cUtf16PathCollisions); 10089 #endif 10090 off += sprintf(&szBuf[off], "%s %10" KSIZE_PRI_U " child hash tables, total of %" KSIZE_PRI_U " entries, %" KSIZE_PRI_U " children inserted, %" KSIZE_PRI_U " collisions\n", 10091 szPrf, g_pFsCache->cChildHashTabs, g_pFsCache->cChildHashEntriesTotal, 10092 g_pFsCache->cChildHashed, g_pFsCache->cChildHashCollisions); 10093 10094 cMisses = g_pFsCache->cLookups - g_pFsCache->cPathHashHits - g_pFsCache->cWalkHits; 10095 off += sprintf(&szBuf[off], "%s %10" KSIZE_PRI_U " lookups: %" KSIZE_PRI_U " (%" KU64_PRI " %%) path hash hits, %" KSIZE_PRI_U " (%" KU64_PRI "%%) walks hits, %" KSIZE_PRI_U " (%" KU64_PRI "%%) misses\n", 10096 szPrf, g_pFsCache->cLookups, 10097 g_pFsCache->cPathHashHits, g_pFsCache->cPathHashHits * (KU64)100 / K_MAX(g_pFsCache->cLookups, 1), 10098 g_pFsCache->cWalkHits, g_pFsCache->cWalkHits * (KU64)100 / K_MAX(g_pFsCache->cLookups, 1), 10099 cMisses, cMisses * (KU64)100 / K_MAX(g_pFsCache->cLookups, 1)); 10100 off += sprintf(&szBuf[off], "%s %10" KSIZE_PRI_U " child searches, %" KSIZE_PRI_U " (%" KU64_PRI "%%) hash hits\n", 10101 szPrf, g_pFsCache->cChildSearches, 10102 g_pFsCache->cChildHashHits, g_pFsCache->cChildHashHits * (KU64)100 / K_MAX(g_pFsCache->cChildSearches, 1)); 10103 off += sprintf(&szBuf[off], "%s %10" KSIZE_PRI_U " name changes, growing %" KSIZE_PRI_U " times (%" KU64_PRI "%%)\n", 10104 szPrf, g_pFsCache->cNameChanges, g_pFsCache->cNameGrowths, 10105 g_pFsCache->cNameGrowths * 100 / K_MAX(g_pFsCache->cNameChanges, 1) ); 10106 10107 10108 /* 10109 * Process & Memory details. 10110 */ 10111 if (!GetProcessHandleCount(GetCurrentProcess(), &cHandles)) 10112 cHandles = 0; 10113 MemInfo.cb = sizeof(MemInfo); 10114 if (!GetProcessMemoryInfo(GetCurrentProcess(), (PPROCESS_MEMORY_COUNTERS)&MemInfo, sizeof(MemInfo))) 10115 memset(&MemInfo, 0, sizeof(MemInfo)); 10116 off += sprintf(&szBuf[off], "%s %10" KU32_PRI " handles; %" KU32_PRI " page faults; %" KSIZE_PRI_U " bytes page file, peaking at %" KSIZE_PRI_U " bytes\n", 10117 szPrf, cHandles, MemInfo.PageFaultCount, MemInfo.PagefileUsage, MemInfo.PeakPagefileUsage); 10118 off += sprintf(&szBuf[off], "%s %10" KSIZE_PRI_U " bytes working set, peaking at %" KSIZE_PRI_U " bytes; %" KSIZE_PRI_U " byte private\n", 10119 szPrf, MemInfo.WorkingSetSize, MemInfo.PeakWorkingSetSize, MemInfo.PrivateUsage); 10120 off += sprintf(&szBuf[off], "%s %10" KSIZE_PRI_U " bytes non-paged pool, peaking at %" KSIZE_PRI_U " bytes; %7" KSIZE_PRI_U " bytes paged pool, peaking at %" KSIZE_PRI_U " bytes\n", 10121 szPrf, MemInfo.QuotaNonPagedPoolUsage, MemInfo.QuotaPeakNonPagedPoolUsage, 10122 MemInfo.QuotaPagedPoolUsage, MemInfo.QuotaPeakPagedPoolUsage); 10123 10124 if (!GetProcessIoCounters(GetCurrentProcess(), &IoCounters)) 10125 memset(&IoCounters, 0, sizeof(IoCounters)); 10126 off += sprintf(&szBuf[off], "%s %10" KU64_PRI " bytes in %" KU64_PRI " reads\n", 10127 szPrf, IoCounters.ReadTransferCount, IoCounters.ReadOperationCount); 10128 off += sprintf(&szBuf[off], "%s %10" KU64_PRI " bytes in %" KU64_PRI " writes\n", 10129 szPrf, IoCounters.WriteTransferCount, IoCounters.WriteOperationCount); 10130 off += sprintf(&szBuf[off], "%s %10" KU64_PRI " bytes in %" KU64_PRI " other I/O operations\n", 10131 szPrf, IoCounters.OtherTransferCount, IoCounters.OtherOperationCount); 10132 10133 MemStatus.dwLength = sizeof(MemStatus); 10134 if (!GlobalMemoryStatusEx(&MemStatus)) 10135 memset(&MemStatus, 0, sizeof(MemStatus)); 10136 off += sprintf(&szBuf[off], "%s %10" KU64_PRI " bytes used VA, %#" KX64_PRI " bytes available\n", szPrf, 10137 MemStatus.ullTotalVirtual - MemStatus.ullAvailVirtual, MemStatus.ullAvailVirtual); 10138 off += sprintf(&szBuf[off], "%s %9u%% system memory load\n", szPrf, MemStatus.dwMemoryLoad); 10139 10140 maybe_con_fwrite(szBuf, off, 1, stdout); 10141 fflush(stdout); 10142 } 10143 10144 10145 /** 10039 10146 * Handles what comes after --test. 10040 10147 * … … 10136 10243 kwSandboxCleanupLate(&g_Sandbox); 10137 10244 } 10245 10246 if (getenv("KWORKER_STATS") != NULL) 10247 kwPrintStats(); 10138 10248 10139 10249 # ifdef WITH_LOG_FILE … … 10436 10546 CloseHandle(g_hLogFile); 10437 10547 #endif 10548 if (getenv("KWORKER_STATS") != NULL) 10549 kwPrintStats(); 10438 10550 return rc > 0 ? 0 : 1; 10439 10551 }
Note:
See TracChangeset
for help on using the changeset viewer.