Changeset 240
- Timestamp:
- 01/24/10 18:53:20 (2 years ago)
- Location:
- branches/stable
- Files:
-
- 12 added
- 3 deleted
- 17 edited
-
AutoBuild.h (modified) (1 diff)
-
NSC.dist (modified) (1 diff)
-
changelog (modified) (1 diff)
-
include/PDHCollectors.h (deleted)
-
include/PDHCounter.cpp (deleted)
-
include/PDHCounter.h (deleted)
-
include/config.h (modified) (1 diff)
-
include/error.hpp (modified) (3 diffs)
-
include/pdh (added)
-
include/pdh.hpp (added)
-
include/pdh/basic_impl.cpp (added)
-
include/pdh/basic_impl.hpp (added)
-
include/pdh/collectors.hpp (added)
-
include/pdh/core.cpp (added)
-
include/pdh/core.hpp (added)
-
include/pdh/counters.hpp (added)
-
include/pdh/enumerations.hpp (added)
-
include/pdh/query.hpp (added)
-
include/pdh/resolver.hpp (added)
-
include/pdh/thread_safe_impl.hpp (added)
-
include/strEx.h (modified) (1 diff)
-
modules/CheckDisk/CheckDisk.cpp (modified) (22 diffs)
-
modules/CheckSystem/CheckSystem-2005.vcproj (modified) (4 diffs)
-
modules/CheckSystem/CheckSystem.cpp (modified) (7 diffs)
-
modules/CheckSystem/CheckSystem.h (modified) (1 diff)
-
modules/CheckSystem/Jamfile (modified) (2 diffs)
-
modules/CheckSystem/PDHCollector.cpp (modified) (2 diffs)
-
modules/CheckSystem/PDHCollector.h (modified) (1 diff)
-
modules/DebugLogMetrics/DebugLogMetrics-2005.vcproj (modified) (2 diffs)
-
modules/DebugLogMetrics/Jamfile (modified) (2 diffs)
-
modules/DebugLogMetrics/PDHCollector.cpp (modified) (4 diffs)
-
modules/DebugLogMetrics/PDHCollector.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/AutoBuild.h
r228 r240 3 3 // change the FALSE to TRUE for autoincrement of build number 4 4 #define INCREMENT_VERSION TRUE 5 #define FILEVER 0,3,8, 36 #define PRODUCTVER 0,3,8, 37 #define STRFILEVER _T("0.3.8. 3")8 #define STRPRODUCTVER _T("0.3.8. 3")9 #define STRPRODUCTDATE _T("20 09-12-31")5 #define FILEVER 0,3,8,10 6 #define PRODUCTVER 0,3,8,10 7 #define STRFILEVER _T("0.3.8.10") 8 #define STRPRODUCTVER _T("0.3.8.10") 9 #define STRPRODUCTDATE _T("2010-01-24") 10 10 #endif // AUTOBUILD_H -
branches/stable/NSC.dist
r189 r240 179 179 ;allow_nasty_meta_chars=0 180 180 ; 181 ;# COMMAND ALLOW NASTY META CHARS 182 ; This option determines whether or not the NRPE daemon will allow clients to specify nasty (as in |`&><'"\[]{}) characters in arguments. 181 ;# SCRIPT DIRECTORY 182 ; All files in this directory will become check commands. 183 ; *WARNING* This is undoubtedly dangerous so use with care! 183 184 ;script_dir=c:\my\script\dir 184 185 -
branches/stable/changelog
r228 r240 6 6 * Fix depend onservice LanManWorkStation (old win) 7 7 * Fix RtlStringFromGUID problem on NT4 8 9 2009-01-24 MickeM 10 * Fixed so files locked for reading can be chcked (basic checks) 11 * Improved speed of file chyecking (does not check file data twice) 12 13 2009-01-23 MickeM 14 + Added checks for missing path and missing filter on CheckFile2 thus 15 CheckFile2 without paths and/or filters will have status unknown. 16 * Changed "missing" disks are now a critical error and not unknown 17 * Improved CheckDriveSize bad FilterType error message 18 + Added checks for missing counters to CheckCounter 19 + Added new thread safe PDH subsystem (switch using the new option pdh_subsystem=thread-safe (normal mode is fast). 20 The reason for this new subsystem is to allow reloading counters and get around some quirks in various PDH implementations (mainly HP) 21 Added benefits of this new mode is that you can now reload counters which are changed during runtime. 22 This is done by adding the reload flag to the CheckCounter command. 23 THIS IS AN ADVANCED FEATURE (so dont use unless you know what you are doing) 24 + Added new index option to CheckCounter to allow looking up index and thus you can use the same checks on multiple locales and also use characters not present in "NRPE charset) 25 CheckCounter index "Counter=\1450(_Total)\1458" ShowAll MaxWarn=500 MaxCrit=1000 26 same as 27 CheckCounter "Counter=\\Utskriftskö(_Total)\\Utskrifter" ShowAll MaxWarn=500 MaxCrit=1000 28 To find index you can use the command line options: 29 nsclient++ -noboot CheckSystem pdhlookup Utskrifter 8 30 9 31 2009-12-31 MickeM -
branches/stable/include/config.h
r188 r240 140 140 #define C_SYSTEM_IGNORE_COLLECTION _T("debug_skip_data_collection") 141 141 #define C_SYSTEM_IGNORE_COLLECTION_DEFAULT 0 142 #define C_SYSTEM_PDH_SUBSYSTEM _T("pdh_subsystem") 143 #define C_SYSTEM_PDH_SUBSYSTEM_DEFAULT _T("fast") 142 144 143 145 #define C_SYSTEM_MEM_PAGE_LIMIT _T("MemoryCommitLimit") -
branches/stable/include/error.hpp
r175 r240 17 17 TCHAR *szBuf = new TCHAR[dwRet + 100]; 18 18 wsprintf(szBuf, _T("%d: %s"), dwError, lpMsgBuf); 19 strEx::strip_CRLF(szBuf); 19 20 std::wstring str = szBuf; 20 21 delete [] szBuf; … … 30 31 } 31 32 TCHAR *szBuf = new TCHAR[dwRet + 100]; 32 wsprintf(szBuf, _T("%d: %s"), dwError, lpMsgBuf); 33 wsprintf(szBuf, _T("%s (%X)"), lpMsgBuf, dwError); 34 strEx::strip_CRLF(szBuf); 33 35 std::wstring str = szBuf; 34 36 delete [] szBuf; … … 49 51 } 50 52 TCHAR *szBuf = new TCHAR[dwRet + 100]; 51 wsprintf(szBuf, _T("%d: %s"), dwError, lpMsgBuf); 53 wsprintf(szBuf, _T("%s (%X)"), lpMsgBuf, dwError); 54 strEx::strip_CRLF(szBuf); 52 55 std::wstring str = szBuf; 53 56 delete [] szBuf; -
branches/stable/include/strEx.h
r189 r240 209 209 filetime /= SECS_TO_100NS; 210 210 return format_date(static_cast<time_t>(filetime), format); 211 } 212 213 inline void strip_CRLF(wchar_t *string) { 214 int len = wcslen(string); 215 for (int i=0;i<len;i++) { 216 if (string[i] == 10 || string[i] == 13) 217 string[i] = L' '; 218 } 211 219 } 212 220 -
branches/stable/modules/CheckDisk/CheckDisk.cpp
r228 r240 75 75 76 76 77 77 78 struct file_finder_data { 78 79 file_finder_data(const WIN32_FIND_DATA wfd_, const std::wstring path_, error_reporter *errors_) : wfd(wfd_), path(path_), errors(errors_) {} … … 169 170 bool bFilterFixed = false; 170 171 bool bFilterCDROM = false; 172 bool bFilterNoRootDir = false; 171 173 bool bCheckAllDrives = false; 172 174 bool bCheckAllOthers = false; … … 184 186 MAP_OPTIONS_BOOL_VALUE(_T("FilterType"), bFilterRemovable, _T("REMOVABLE")) 185 187 MAP_OPTIONS_BOOL_VALUE(_T("FilterType"), bFilterRemote, _T("REMOTE")) 188 MAP_OPTIONS_BOOL_VALUE(_T("FilterType"), bFilterNoRootDir, _T("NO_ROOT_DIR")) 186 189 MAP_OPTIONS_BOOL_FALSE(IGNORE_PERFDATA, bPerfData) 187 190 MAP_OPTIONS_BOOL_TRUE(NSCLIENT, bNSClient) … … 213 216 214 217 UINT drvType = GetDriveType(drv.c_str()); 215 if ( ((!bFilter)&&(drvType == DRIVE_FIXED)) || 218 if ( 219 ((!bFilter)&&(drvType == DRIVE_FIXED)) || 216 220 ((bFilter)&&(bFilterFixed)&&(drvType==DRIVE_FIXED)) || 217 221 ((bFilter)&&(bFilterCDROM)&&(drvType==DRIVE_CDROM)) || 218 222 ((bFilter)&&(bFilterRemote)&&(drvType==DRIVE_REMOTE)) || 219 ((bFilter)&&(bFilterRemovable)&&(drvType==DRIVE_REMOVABLE)) ) 223 ((bFilter)&&(bFilterRemovable)&&(drvType==DRIVE_REMOVABLE)) || 224 ((bFilter)&&(bFilterNoRootDir)&&(drvType==DRIVE_NO_ROOT_DIR)) 225 ) 220 226 drives.push_back(DriveContainer(drv, tmpObject.warn, tmpObject.crit)); 221 227 … … 240 246 ((bFilter)&&(bFilterCDROM)&&(drvType==DRIVE_CDROM)) || 241 247 ((bFilter)&&(bFilterRemote)&&(drvType==DRIVE_REMOTE)) || 242 ((bFilter)&&(bFilterRemovable)&&(drvType==DRIVE_REMOVABLE)) ) 248 ((bFilter)&&(bFilterRemovable)&&(drvType==DRIVE_REMOVABLE)) || 249 ((bFilter)&&(bFilterNoRootDir)&&(drvType==DRIVE_NO_ROOT_DIR)) 250 ) 243 251 drives.push_back(DriveContainer(drv, tmpObject.warn, tmpObject.crit)); 244 252 } … … 260 268 ((bFilter)&&(bFilterCDROM)&&(drvType==DRIVE_CDROM)) || 261 269 ((bFilter)&&(bFilterRemote)&&(drvType==DRIVE_REMOTE)) || 262 ((bFilter)&&(bFilterRemovable)&&(drvType==DRIVE_REMOVABLE)) ) 270 ((bFilter)&&(bFilterRemovable)&&(drvType==DRIVE_REMOVABLE)) || 271 ((bFilter)&&(bFilterNoRootDir)&&(drvType==DRIVE_NO_ROOT_DIR)) 272 ) 263 273 { 264 274 bool bFound = false; … … 289 299 message = _T("UNKNOWN: Drive is not a fixed drive: ") + drive.getAlias() + _T(" (it is a ") + get_filter(drvType) + _T(" drive)"); 290 300 return NSCAPI::returnUNKNOWN; 291 } else if ( (bFilter)&&( (!bFilterFixed)&&((drvType==DRIVE_FIXED)||(drvType==DRIVE_NO_ROOT_DIR))) || 301 } else if ( (bFilter)&& 302 ( 303 ((!bFilterFixed)&&((drvType==DRIVE_FIXED)||(drvType==DRIVE_NO_ROOT_DIR))) || 292 304 ((!bFilterCDROM)&&(drvType==DRIVE_CDROM)) || 293 305 ((!bFilterRemote)&&(drvType==DRIVE_REMOTE)) || 294 ((!bFilterRemovable)&&(drvType==DRIVE_REMOVABLE)) ) { 295 message = _T("UNKNOWN: Drive does not match the current filter: ") + drive.getAlias() + _T(" (it is a ") + get_filter(drvType) + _T(" drive)"); 306 ((!bFilterRemovable)&&(drvType==DRIVE_REMOVABLE)) 307 )) { 308 message = _T("UNKNOWN: Drive does not match the current filter: ") + drive.getAlias() + _T(" (add FilterType=") + get_filter(drvType) + _T(" to check this drive)"); 296 309 return NSCAPI::returnUNKNOWN; 297 310 } … … 301 314 ULARGE_INTEGER totalNumberOfFreeBytes; 302 315 if (!GetDiskFreeSpaceEx(drive.data.c_str(), &freeBytesAvailableToCaller, &totalNumberOfBytes, &totalNumberOfFreeBytes)) { 303 message = _T(" UNKNOWN: Could not get free space for: ") + drive.getAlias() + _T(" ") + drive.data + _T(" reason: ") + error::lookup::last_error();304 return NSCAPI::return UNKNOWN;316 message = _T("CRITICAL: Could not get free space for: ") + drive.getAlias() + _T(" ") + drive.data + _T(" reason: ") + error::lookup::last_error(); 317 return NSCAPI::returnCRIT; 305 318 } 306 319 … … 329 342 std::wstring CheckDisk::get_filter(unsigned int drvType) { 330 343 if (drvType==DRIVE_FIXED) 331 return _T(" fixed");344 return _T("FIXED"); 332 345 if (drvType==DRIVE_NO_ROOT_DIR) 333 return _T(" no_root");346 return _T("NO_ROOT_DIR"); 334 347 if (drvType==DRIVE_CDROM) 335 return _T(" cdrom");348 return _T("CDROM"); 336 349 if (drvType==DRIVE_REMOTE) 337 return _T(" remote");350 return _T("REMOTE"); 338 351 if (drvType==DRIVE_REMOVABLE) 339 return _T(" removable");352 return _T("REMOVABLE"); 340 353 return _T("unknown: ") + strEx::itos(drvType); 341 354 } … … 437 450 438 451 struct file_info { 452 453 std::wstring error; 454 bool has_error; 455 456 static file_info get(std::wstring path, std::wstring file) { 457 return get_2(path, file); 458 } 459 static file_info get(file_finder_data data) { 460 return file_info(data.wfd, data.path, data.wfd.cFileName); 461 } 462 463 static file_info get_2(std::wstring path, std::wstring file) { 464 WIN32_FILE_ATTRIBUTE_DATA data; 465 if (!GetFileAttributesEx((path + _T("\\") + file).c_str(), GetFileExInfoStandard, reinterpret_cast<LPVOID>(&data))) { 466 file_info ret; 467 ret.error = _T("Could not open file (2) ") + path + _T("\\") + file + _T(": ") + error::lookup::last_error(); 468 return ret; 469 } 470 return file_info(data, path, file); 471 } 472 static file_info get_1(std::wstring path, std::wstring file) { 473 HANDLE hFile = CreateFile((path + _T("\\") + file).c_str(), FILE_READ_ATTRIBUTES, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); 474 if (hFile == INVALID_HANDLE_VALUE) { 475 file_info ret; 476 ret.error = _T("Could not open file (1) ") + path + _T("\\") + file + _T(": ") + error::lookup::last_error(); 477 return ret; 478 } 479 BY_HANDLE_FILE_INFORMATION _info; 480 GetFileInformationByHandle(hFile, &_info); 481 CloseHandle(hFile); 482 return file_info(_info, path, file); 483 } 484 439 485 file_info() 440 486 : ullCreationTime(0) … … 445 491 , cached_count(false, 0) 446 492 {} 493 file_info(const WIN32_FILE_ATTRIBUTE_DATA info, std::wstring path_, std::wstring filename_) 494 : path(path_) 495 , filename(filename_) 496 , ullCreationTime(0) 497 , ullLastAccessTime(0) 498 , ullLastWriteTime(0) 499 , ullSize(0) 500 , cached_version(false, _T("")) 501 , cached_count(false, 0) 502 { 503 ullSize = ((info.nFileSizeHigh * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)info.nFileSizeLow); 504 ullCreationTime = ((info.ftCreationTime.dwHighDateTime * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)info.ftCreationTime.dwLowDateTime); 505 ullLastAccessTime = ((info.ftLastAccessTime.dwHighDateTime * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)info.ftLastAccessTime.dwLowDateTime); 506 ullLastWriteTime = ((info.ftLastWriteTime.dwHighDateTime * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)info.ftLastWriteTime.dwLowDateTime); 507 }; 447 508 file_info(const BY_HANDLE_FILE_INFORMATION info, std::wstring path_, std::wstring filename_) 448 509 : path(path_) … … 455 516 , cached_count(false, 0) 456 517 { 457 std::wcout << _T("[") << filename_ << _T("]") << std::endl; 458 std::cout << "C: " << info.ftCreationTime.dwHighDateTime << ":" << info.ftCreationTime.dwLowDateTime << std::endl; 459 std::cout << "A: " << info.ftLastAccessTime.dwHighDateTime << ":" << info.ftLastAccessTime.dwLowDateTime << std::endl; 460 std::cout << "M: " << info.ftLastWriteTime.dwHighDateTime << ":" << info.ftLastWriteTime.dwLowDateTime << std::endl; 518 ullSize = ((info.nFileSizeHigh * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)info.nFileSizeLow); 519 ullCreationTime = ((info.ftCreationTime.dwHighDateTime * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)info.ftCreationTime.dwLowDateTime); 520 ullLastAccessTime = ((info.ftLastAccessTime.dwHighDateTime * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)info.ftLastAccessTime.dwLowDateTime); 521 ullLastWriteTime = ((info.ftLastWriteTime.dwHighDateTime * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)info.ftLastWriteTime.dwLowDateTime); 522 }; 523 file_info(const WIN32_FIND_DATA info, std::wstring path_, std::wstring filename_) 524 : path(path_) 525 , filename(filename_) 526 , ullCreationTime(0) 527 , ullLastAccessTime(0) 528 , ullLastWriteTime(0) 529 , ullSize(0) 530 , cached_version(false, _T("")) 531 , cached_count(false, 0) 532 { 461 533 ullSize = ((info.nFileSizeHigh * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)info.nFileSizeLow); 462 534 ullCreationTime = ((info.ftCreationTime.dwHighDateTime * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)info.ftCreationTime.dwLowDateTime); … … 626 698 if (is_directory(ffd.wfd.dwFileAttributes)) 627 699 return true; 700 701 file_info info = file_info::get(ffd); 702 if (!info.error.empty()) { 703 setError(ffd.errors, info.error); 704 return false; 705 } 706 return false; 707 /* 628 708 BY_HANDLE_FILE_INFORMATION _info; 629 709 630 HANDLE hFile = CreateFile((ffd.path + _T("\\") + ffd.wfd.cFileName).c_str(), GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,710 HANDLE hFile = CreateFile((ffd.path + _T("\\") + ffd.wfd.cFileName).c_str(), FILE_READ_ATTRIBUTES, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, 631 711 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); 632 712 if (hFile == INVALID_HANDLE_VALUE) { … … 638 718 info = file_info(_info, ffd.path, ffd.wfd.cFileName); 639 719 return false; 720 */ 640 721 } 641 722 inline const bool hasError() const { … … 665 746 if (is_directory(ffd.wfd.dwFileAttributes)) 666 747 return true; 748 749 file_info info = file_info::get(ffd); 750 if (!info.error.empty()) { 751 setError(ffd.errors, info.error); 752 return true; 753 } 754 /* 667 755 BY_HANDLE_FILE_INFORMATION _info; 668 756 669 HANDLE hFile = CreateFile((ffd.path + _T("\\") + ffd.wfd.cFileName).c_str(), GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,757 HANDLE hFile = CreateFile((ffd.path + _T("\\") + ffd.wfd.cFileName).c_str(), FILE_READ_ATTRIBUTES, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, 670 758 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); 671 759 if (hFile == INVALID_HANDLE_VALUE) { … … 677 765 file_info info(_info, ffd.path, ffd.wfd.cFileName); 678 766 info.ullNow = now; 767 */ 679 768 680 769 for (std::list<file_filter>::const_iterator cit3 = filter_chain.begin(); cit3 != filter_chain.end(); ++cit3 ) { … … 741 830 if (is_directory(ffd.wfd.dwFileAttributes)) 742 831 return true; 832 833 file_info info = file_info::get(ffd); 834 if (!info.error.empty()) { 835 setError(ffd.errors, info.error); 836 return true; 837 } 838 /* 743 839 BY_HANDLE_FILE_INFORMATION _info; 744 840 745 HANDLE hFile = CreateFile((ffd.path + _T("\\") + ffd.wfd.cFileName).c_str(), GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,841 HANDLE hFile = CreateFile((ffd.path + _T("\\") + ffd.wfd.cFileName).c_str(), FILE_READ_ATTRIBUTES, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, 746 842 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); 747 843 if (hFile == INVALID_HANDLE_VALUE) { … … 753 849 file_info info(_info, ffd.path, ffd.wfd.cFileName); 754 850 info.ullNow = now; 851 */ 755 852 756 853 bool bMatch = !bFilterIn; … … 808 905 strEx::replace(syntax, _T("%files%"), strEx::itos(file_count)); 809 906 return syntax; 907 } 908 909 bool has_filter() { 910 return !filter_chain.empty(); 810 911 } 811 912 … … 1010 1111 message = e.getMessage(); 1011 1112 return NSCAPI::returnUNKNOWN; 1012 } 1013 FILETIME now; 1014 GetSystemTimeAsFileTime(&now); 1015 finder.debug_ = debug; 1016 finder.now = ((now.dwHighDateTime * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)now.dwLowDateTime); 1017 if (debug) 1018 NSC_DEBUG_MSG_STD(_T("NOW: ") + strEx::format_filetime(finder.now)); 1019 finder.syntax = syntax; 1020 NSC_error errors; 1021 for (std::list<std::wstring>::const_iterator pit = paths.begin(); pit != paths.end(); ++pit) { 1022 recursive_scan<file_filter_function_ex>(*pit, pattern, 0, max_dir_depth, finder, &errors, debug); 1023 if (!ignoreError && finder.hasError()) { 1024 message = _T("Error when scanning: ") + (*pit) + _T(" check log for details (") + strEx::itos(finder.error_count) + _T(": ") + finder.last_error + _T(")"); 1025 return NSCAPI::returnUNKNOWN; 1026 } 1027 } 1028 message = finder.render(masterSyntax); 1029 if (!alias.empty()) 1030 query.alias = alias; 1031 else 1032 query.alias = _T("found files"); 1033 query.runCheck(finder.hit_count, returnCode, message, perf); 1034 if ((truncate > 0) && (message.length() > (truncate-4))) { 1035 message = message.substr(0, truncate-4) + _T("..."); 1036 //perf = _T(""); 1037 } 1038 if (message.empty()) 1039 message = _T("CheckFile ok"); 1040 return returnCode; 1113 } 1114 if (paths.empty()) { 1115 message = _T("Missing path argument"); 1116 return NSCAPI::returnUNKNOWN; 1117 } 1118 if (!finder.has_filter()) { 1119 message = _T("Missing filter argument"); 1120 return NSCAPI::returnUNKNOWN; 1121 } 1122 FILETIME now; 1123 GetSystemTimeAsFileTime(&now); 1124 finder.debug_ = debug; 1125 finder.now = ((now.dwHighDateTime * ((unsigned long long)MAXDWORD+1)) + (unsigned long long)now.dwLowDateTime); 1126 if (debug) 1127 NSC_DEBUG_MSG_STD(_T("NOW: ") + strEx::format_filetime(finder.now)); 1128 finder.syntax = syntax; 1129 NSC_error errors; 1130 for (std::list<std::wstring>::const_iterator pit = paths.begin(); pit != paths.end(); ++pit) { 1131 recursive_scan<file_filter_function_ex>(*pit, pattern, 0, max_dir_depth, finder, &errors, debug); 1132 if (!ignoreError && finder.hasError()) { 1133 message = _T("Error when scanning: ") + (*pit) + _T(" check log for details (") + strEx::itos(finder.error_count) + _T(": ") + finder.last_error + _T(")"); 1134 return NSCAPI::returnUNKNOWN; 1135 } 1136 } 1137 message = finder.render(masterSyntax); 1138 if (!alias.empty()) 1139 query.alias = alias; 1140 else 1141 query.alias = _T("found files"); 1142 query.runCheck(finder.hit_count, returnCode, message, perf); 1143 if ((truncate > 0) && (message.length() > (truncate-4))) { 1144 message = message.substr(0, truncate-4) + _T("..."); 1145 //perf = _T(""); 1146 } 1147 if (message.empty()) 1148 message = _T("CheckFile ok"); 1149 return returnCode; 1041 1150 } 1042 1151 struct file_container : public file_info { 1043 1152 std::wstring error_; 1044 1153 1154 static file_container get(std::wstring file, unsigned long long now) { 1155 1156 BY_HANDLE_FILE_INFORMATION _info; 1157 1158 HANDLE hFile = CreateFile(file.c_str(), FILE_READ_ATTRIBUTES, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, 1159 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); 1160 if (hFile == INVALID_HANDLE_VALUE) { 1161 return file_container(file, _T("Could not open file: ") + file); 1162 } 1163 GetFileInformationByHandle(hFile, &_info); 1164 CloseHandle(hFile); 1165 file_container info(_info, file); 1166 info.ullNow = now; 1167 return info; 1168 } 1169 1045 1170 1046 1171 file_container(const BY_HANDLE_FILE_INFORMATION info, std::wstring file) : file_info(info, file_helpers::meta::get_path(file), file_helpers::meta::get_filename(file)) {} … … 1120 1245 } 1121 1246 }; 1122 1123 file_container get_file_info(std::wstring file, unsigned long long now) {1124 1125 BY_HANDLE_FILE_INFORMATION _info;1126 1127 HANDLE hFile = CreateFile(file.c_str(), GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,1128 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);1129 if (hFile == INVALID_HANDLE_VALUE) {1130 return file_container(file, _T("Could not open file: ") + file);1131 }1132 GetFileInformationByHandle(hFile, &_info);1133 CloseHandle(hFile);1134 file_container info(_info, file);1135 info.ullNow = now;1136 return info;1137 }1138 1247 1139 1248 #define MAP_FACTORY_PB(value, obj) \ … … 1192 1301 //finder.syntax = syntax; 1193 1302 for (std::list<std::wstring>::const_iterator pit = files.begin(); pit != files.end(); ++pit) { 1194 file_container info = get_file_info(*pit, nowi64);1303 file_container info = file_container::get(*pit, nowi64); 1195 1304 checker.alias = info.render(syntax); 1196 1305 checker.runCheck(info, returnCode, message, perf); -
branches/stable/modules/CheckSystem/CheckSystem-2005.vcproj
r170 r240 69 69 <Tool 70 70 Name="VCLinkerTool" 71 AdditionalDependencies="Pdh.lib"72 71 OutputFile="$(OutDir)\$(ProjectName).dll" 73 72 LinkIncremental="2" … … 2038 2037 </File> 2039 2038 <File 2040 RelativePath="..\..\include\PDHCounter.cpp"2041 >2042 <FileConfiguration2043 Name="Debug|Win32"2044 >2045 <Tool2046 Name="VCCLCompilerTool"2047 UsePrecompiledHeader="0"2048 />2049 </FileConfiguration>2050 <FileConfiguration2051 Name="Debug|x64"2052 >2053 <Tool2054 Name="VCCLCompilerTool"2055 UsePrecompiledHeader="0"2056 />2057 </FileConfiguration>2058 <FileConfiguration2059 Name="Release|Win32"2060 >2061 <Tool2062 Name="VCCLCompilerTool"2063 UsePrecompiledHeader="0"2064 />2065 </FileConfiguration>2066 <FileConfiguration2067 Name="Release|x64"2068 >2069 <Tool2070 Name="VCCLCompilerTool"2071 UsePrecompiledHeader="0"2072 />2073 </FileConfiguration>2074 <FileConfiguration2075 Name="Distribution|Win32"2076 >2077 <Tool2078 Name="VCCLCompilerTool"2079 UsePrecompiledHeader="0"2080 />2081 </FileConfiguration>2082 <FileConfiguration2083 Name="Distribution|x64"2084 >2085 <Tool2086 Name="VCCLCompilerTool"2087 UsePrecompiledHeader="0"2088 />2089 </FileConfiguration>2090 <FileConfiguration2091 Name="Nightly|Win32"2092 >2093 <Tool2094 Name="VCCLCompilerTool"2095 UsePrecompiledHeader="0"2096 />2097 </FileConfiguration>2098 <FileConfiguration2099 Name="Nightly|x64"2100 >2101 <Tool2102 Name="VCCLCompilerTool"2103 UsePrecompiledHeader="0"2104 />2105 </FileConfiguration>2106 <FileConfiguration2107 Name="Debug-MemCheck|Win32"2108 >2109 <Tool2110 Name="VCCLCompilerTool"2111 UsePrecompiledHeader="0"2112 />2113 </FileConfiguration>2114 <FileConfiguration2115 Name="Debug-MemCheck|x64"2116 >2117 <Tool2118 Name="VCCLCompilerTool"2119 UsePrecompiledHeader="0"2120 />2121 </FileConfiguration>2122 <FileConfiguration2123 Name="OP5|Win32"2124 >2125 <Tool2126 Name="VCCLCompilerTool"2127 UsePrecompiledHeader="0"2128 />2129 </FileConfiguration>2130 <FileConfiguration2131 Name="OP5|x64"2132 >2133 <Tool2134 Name="VCCLCompilerTool"2135 UsePrecompiledHeader="0"2136 />2137 </FileConfiguration>2138 </File>2139 <File2140 2039 RelativePath=".\stdafx.cpp" 2141 2040 > … … 2573 2472 </File> 2574 2473 <File 2575 RelativePath="..\..\include\PDHCollectors.h"2576 >2577 </File>2578 <File2579 RelativePath="..\..\include\PDHCounter.h"2580 >2581 </File>2582 <File2583 2474 RelativePath=".\stdafx.h" 2584 2475 > … … 2594 2485 <File 2595 2486 RelativePath="..\..\include\utils.h" 2487 > 2488 </File> 2489 </Filter> 2490 <Filter 2491 Name="PDH" 2492 > 2493 <File 2494 RelativePath="..\..\include\pdh\basic_impl.cpp" 2495 > 2496 <FileConfiguration 2497 Name="Debug|Win32" 2498 > 2499 <Tool 2500 Name="VCCLCompilerTool" 2501 UsePrecompiledHeader="0" 2502 /> 2503 </FileConfiguration> 2504 <FileConfiguration 2505 Name="Debug|x64" 2506 > 2507 <Tool 2508 Name="VCCLCompilerTool" 2509 UsePrecompiledHeader="0" 2510 /> 2511 </FileConfiguration> 2512 <FileConfiguration 2513 Name="Release|Win32" 2514 > 2515 <Tool 2516 Name="VCCLCompilerTool" 2517 UsePrecompiledHeader="0" 2518 /> 2519 </FileConfiguration> 2520 <FileConfiguration 2521 Name="Release|x64" 2522 > 2523 <Tool 2524 Name="VCCLCompilerTool" 2525 UsePrecompiledHeader="0" 2526 /> 2527 </FileConfiguration> 2528 <FileConfiguration 2529 Name="Distribution|Win32" 2530 > 2531 <Tool 2532 Name="VCCLCompilerTool" 2533 UsePrecompiledHeader="0" 2534 /> 2535 </FileConfiguration> 2536 <FileConfiguration 2537 Name="Distribution|x64" 2538 > 2539 <Tool 2540 Name="VCCLCompilerTool" 2541 UsePrecompiledHeader="0" 2542 /> 2543 </FileConfiguration> 2544 <FileConfiguration 2545 Name="Nightly|Win32" 2546 > 2547 <Tool 2548 Name="VCCLCompilerTool" 2549 UsePrecompiledHeader="0" 2550 /> 2551 </FileConfiguration> 2552 <FileConfiguration 2553 Name="Nightly|x64" 2554 > 2555 <Tool 2556 Name="VCCLCompilerTool" 2557 UsePrecompiledHeader="0" 2558 /> 2559 </FileConfiguration> 2560 <FileConfiguration 2561 Name="Debug-MemCheck|Win32" 2562 > 2563 <Tool 2564 Name="VCCLCompilerTool" 2565 UsePrecompiledHeader="0" 2566 /> 2567 </FileConfiguration> 2568 <FileConfiguration 2569 Name="Debug-MemCheck|x64" 2570 > 2571 <Tool 2572 Name="VCCLCompilerTool" 2573 UsePrecompiledHeader="0" 2574 /> 2575 </FileConfiguration> 2576 <FileConfiguration 2577 Name="OP5|Win32" 2578 > 2579 <Tool 2580 Name="VCCLCompilerTool" 2581 UsePrecompiledHeader="0" 2582 /> 2583 </FileConfiguration> 2584 <FileConfiguration 2585 Name="OP5|x64" 2586 > 2587 <Tool 2588 Name="VCCLCompilerTool" 2589 UsePrecompiledHeader="0" 2590 /> 2591 </FileConfiguration> 2592 </File> 2593 <File 2594 RelativePath="..\..\include\pdh\basic_impl.hpp" 2595 > 2596 </File> 2597 <File 2598 RelativePath="..\..\include\pdh\collectors.hpp" 2599 > 2600 </File> 2601 <File 2602 RelativePath="..\..\include\pdh\core.cpp" 2603 > 2604 <FileConfiguration 2605 Name="Debug|Win32" 2606 > 2607 <Tool 2608 Name="VCCLCompilerTool" 2609 UsePrecompiledHeader="0" 2610 /> 2611 </FileConfiguration> 2612 <FileConfiguration 2613 Name="Debug|x64" 2614 > 2615 <Tool 2616 Name="VCCLCompilerTool" 2617 UsePrecompiledHeader="0" 2618 /> 2619 </FileConfiguration> 2620 <FileConfiguration 2621 Name="Release|Win32" 2622 > 2623 <Tool 2624 Name="VCCLCompilerTool" 2625 UsePrecompiledHeader="0" 2626 /> 2627 </FileConfiguration> 2628 <FileConfiguration 2629 Name="Release|x64" 2630 > 2631 <Tool 2632 Name="VCCLCompilerTool" 2633 UsePrecompiledHeader="0" 2634 /> 2635 </FileConfiguration> 2636 <FileConfiguration 2637 Name="Distribution|Win32" 2638 > 2639 <Tool 2640 Name="VCCLCompilerTool" 2641 UsePrecompiledHeader="0" 2642 /> 2643 </FileConfiguration> 2644 <FileConfiguration 2645 Name="Distribution|x64" 2646 > 2647 <Tool 2648 Name="VCCLCompilerTool" 2649 UsePrecompiledHeader="0" 2650 /> 2651 </FileConfiguration> 2652 <FileConfiguration 2653 Name="Nightly|Win32" 2654 > 2655 <Tool 2656 Name="VCCLCompilerTool" 2657 UsePrecompiledHeader="0" 2658 /> 2659 </FileConfiguration> 2660 <FileConfiguration 2661 Name="Nightly|x64" 2662 > 2663 <Tool 2664 Name="VCCLCompilerTool" 2665 UsePrecompiledHeader="0" 2666 /> 2667 </FileConfiguration> 2668 <FileConfiguration 2669 Name="Debug-MemCheck|Win32" 2670 > 2671 <Tool 2672 Name="VCCLCompilerTool" 2673 UsePrecompiledHeader="0" 2674 /> 2675 </FileConfiguration> 2676 <FileConfiguration 2677 Name="Debug-MemCheck|x64" 2678 > 2679 <Tool 2680 Name="VCCLCompilerTool" 2681 UsePrecompiledHeader="0" 2682 /> 2683 </FileConfiguration> 2684 <FileConfiguration 2685 Name="OP5|Win32" 2686 > 2687 <Tool 2688 Name="VCCLCompilerTool" 2689 UsePrecompiledHeader="0" 2690 /> 2691 </FileConfiguration> 2692 <FileConfiguration 2693 Name="OP5|x64" 2694 > 2695 <Tool 2696 Name="VCCLCompilerTool" 2697 UsePrecompiledHeader="0" 2698 /> 2699 </FileConfiguration> 2700 </File> 2701 <File 2702 RelativePath="..\..\include\pdh\core.hpp" 2703 > 2704 </File> 2705 <File 2706 RelativePath="..\..\include\pdh\counters.hpp" 2707 > 2708 </File> 2709 <File 2710 RelativePath="..\..\include\pdh\enumerations.hpp" 2711 > 2712 </File> 2713 <File 2714 RelativePath="..\..\include\pdh\query.hpp" 2715 > 2716 </File> 2717 <File 2718 RelativePath="..\..\include\pdh\resolver.hpp" 2719 > 2720 </File> 2721 <File 2722 RelativePath="..\..\include\pdh\single_threaded_impl.hpp" 2596 2723 > 2597 2724 </File> -
branches/stable/modules/CheckSystem/CheckSystem.cpp
r174 r240 133 133 std::wstring error; 134 134 bool bStatus = true; 135 if (PDH:: Enumerations::validate(counter, error)) {135 if (PDH::PDHResolver::validate(counter, error, false)) { 136 136 status.push_back(_T("open")); 137 137 } else { … … 210 210 std::wcout << _T("testing: ") << counter << _T(": "); 211 211 std::wstring error; 212 if (PDH:: Enumerations::validate(counter, error)) {212 if (PDH::PDHResolver::validate(counter, error, false)) { 213 213 std::wcout << _T(" found "); 214 214 } else { … … 262 262 return 0; 263 263 } 264 DWORD dw = PDH::PDH Query::lookupIndex(name);264 DWORD dw = PDH::PDHResolver::lookupIndex(name); 265 265 NSC_LOG_MESSAGE_STD(_T("--+--[ Lookup Result ]----------------------------------------")); 266 266 NSC_LOG_MESSAGE_STD(_T(" | Index for '") + name + _T("' is ") + strEx::itos(dw)); … … 1028 1028 unsigned int averageDelay = 1000; 1029 1029 CounterContainer tmpObject; 1030 bool bExpandIndex = false; 1031 bool bForceReload = false; 1030 1032 1031 1033 MAP_OPTIONS_BEGIN(stl_args) … … 1041 1043 MAP_OPTIONS_BOOL_EX(_T("Averages"), bCheckAverages, _T("true"), _T("false")) 1042 1044 MAP_OPTIONS_BOOL_TRUE(NSCLIENT, bNSClient) 1045 MAP_OPTIONS_BOOL_TRUE(_T("index"), bExpandIndex) 1046 MAP_OPTIONS_BOOL_TRUE(_T("reload"), bForceReload) 1043 1047 MAP_OPTIONS_FIRST_CHAR('\\', tmpObject.data, counters.push_back(tmpObject)) 1044 1048 MAP_OPTIONS_SECONDARY_BEGIN(_T(":"), p2) … … 1052 1056 MAP_OPTIONS_FALLBACK_AND(tmpObject.data, counters.push_back(tmpObject)) 1053 1057 MAP_OPTIONS_END() 1058 1059 if (counters.empty()) { 1060 msg = _T("No counters specified"); 1061 return NSCAPI::returnUNKNOWN; 1062 } 1063 1054 1064 for (std::list<CounterContainer>::const_iterator cit = counters.begin(); cit != counters.end(); ++cit) { 1055 1065 CounterContainer counter = (*cit); 1056 1066 try { 1057 1067 std::wstring tstr; 1058 if (!PDH::Enumerations::validate(counter.data, tstr)) { 1068 if (bExpandIndex) { 1069 PDH::PDHResolver::expand_index(counter.data); 1070 } 1071 if (!PDH::PDHResolver::validate(counter.data, tstr, bForceReload)) { 1059 1072 NSC_LOG_ERROR_STD(_T("ERROR: Counter not found: ") + counter.data + _T(": ") + tstr); 1060 1073 if (bNSClient) { … … 1062 1075 //msg = _T("0"); 1063 1076 } else { 1064 //msg =tstr;1065 //msg += _T(" (") + counter.getAlias() + _T("|") + counter.data + _T(")");1077 msg = _T("CRIT: Counter not found: ") + counter.data + _T(": ") + tstr; 1078 return NSCAPI::returnCRIT; 1066 1079 } 1067 //return NSCHelper::translateReturn(invalidStatus);1068 1080 } 1069 1081 PDH::PDHQuery pdh; -
branches/stable/modules/CheckSystem/CheckSystem.h
r172 r240 21 21 #pragma once 22 22 23 #include <pdh.hpp> 23 24 #include "PDHCollector.h" 24 25 #include <CheckMemory.h> -
branches/stable/modules/CheckSystem/Jamfile
r172 r240 1 1 local target = CheckSystem ; 2 2 local source = $(target) ; 3 4 project5 : requirements6 <find-static-library>Pdh7 ;8 9 10 3 11 4 lib $(target) … … 17 10 ../../include/arrayBuffer.cpp 18 11 ../../include/EnumProcess.cpp 19 ../../include/PDHCounter.cpp20 12 ../../include/EnumNtSrv.cpp 21 13 ../../include/sysinfo.cpp 14 ../../include/pdh/basic_impl.cpp 15 ../../include/pdh/core.cpp 22 16 23 17 : # requirements -
branches/stable/modules/CheckSystem/PDHCollector.cpp
r174 r240 30 30 unsigned int i = strEx::stoui_as_time(s, checkIntervall_*100); 31 31 cpu.resize(i/(checkIntervall_*100)+10); 32 std::wstring subsystem = NSCModuleHelper::getSettingsString(C_SYSTEM_SECTION_TITLE, C_SYSTEM_PDH_SUBSYSTEM, C_SYSTEM_PDH_SUBSYSTEM_DEFAULT); 33 if (subsystem == C_SYSTEM_PDH_SUBSYSTEM_DEFAULT) { 34 } else if (subsystem == _T("thread-safe")) { 35 PDH::PDHFactory::set_threadSafe(); 36 } else { 37 NSC_LOG_ERROR_STD(_T("Unknown PDH subsystem (") + subsystem + _T(") valid values are: fast and thread-safe")); 38 } 32 39 } 33 40 … … 102 109 if (bUseIndex) { 103 110 NSC_DEBUG_MSG_STD(_T("Using index to retrive counternames")); 104 proc = _T("\\") + pdh.lookupIndex(238) + _T("(_total)\\") + pdh.lookupIndex(6);105 uptime = _T("\\") + pdh.lookupIndex(2) + _T("\\") + pdh.lookupIndex(674);106 memCl = _T("\\") + pdh.lookupIndex(4) + _T("\\") + pdh.lookupIndex(30);107 memCb = _T("\\") + pdh.lookupIndex(4) + _T("\\") + pdh.lookupIndex(26);111 proc = _T("\\") + PDH::PDHResolver::lookupIndex(238) + _T("(_total)\\") + PDH::PDHResolver::lookupIndex(6); 112 uptime = _T("\\") + PDH::PDHResolver::lookupIndex(2) + _T("\\") + PDH::PDHResolver::lookupIndex(674); 113 memCl = _T("\\") + PDH::PDHResolver::lookupIndex(4) + _T("\\") + PDH::PDHResolver::lookupIndex(30); 114 memCb = _T("\\") + PDH::PDHResolver::lookupIndex(4) + _T("\\") + PDH::PDHResolver::lookupIndex(26); 108 115 } else { 109 116 settings_core settings; -
branches/stable/modules/CheckSystem/PDHCollector.h
r128 r240 21 21 #pragma once 22 22 23 #include "PDHCollectors.h"23 #include <pdh.hpp> 24 24 #include <thread.h> 25 25 #include <MutexRW.h> -
branches/stable/modules/DebugLogMetrics/DebugLogMetrics-2005.vcproj
r170 r240 1737 1737 </File> 1738 1738 <File 1739 RelativePath="..\..\include\PDHCounter.cpp"1740 >1741 <FileConfiguration1742 Name="Debug|Win32"1743 >1744 <Tool1745 Name="VCCLCompilerTool"1746 UsePrecompiledHeader="0"1747 />1748 </FileConfiguration>1749 <FileConfiguration1750 Name="Debug|x64"1751 >1752 <Tool1753 Name="VCCLCompilerTool"1754 UsePrecompiledHeader="0"1755 />1756 </FileConfiguration>1757 <FileConfiguration1758 Name="Release|Win32"1759 >1760 <Tool1761 Name="VCCLCompilerTool"1762 UsePrecompiledHeader="0"1763 />1764 </FileConfiguration>1765 <FileConfiguration1766 Name="Release|x64"1767 >1768 <Tool1769 Name="VCCLCompilerTool"1770 UsePrecompiledHeader="0"1771 />1772 </FileConfiguration>1773 <FileConfiguration1774 Name="Distribution|Win32"1775 >1776 <Tool1777 Name="VCCLCompilerTool"1778 UsePrecompiledHeader="0"1779 />1780 </FileConfiguration>1781 <FileConfiguration1782 Name="Distribution|x64"1783 >1784 <Tool1785 Name="VCCLCompilerTool"1786 UsePrecompiledHeader="0"1787 />1788 </FileConfiguration>1789 <FileConfiguration1790 Name="Nightly|Win32"1791 >1792 <Tool1793 Name="VCCLCompilerTool"1794 UsePrecompiledHeader="0"1795 />1796 </FileConfiguration>1797 <FileConfiguration1798 Name="Nightly|x64"1799 >1800 <Tool1801 Name="VCCLCompilerTool"1802 UsePrecompiledHeader="0"1803 />1804 </FileConfiguration>1805 <FileConfiguration1806 Name="Debug-MemCheck|Win32"1807 >1808 <Tool1809 Name="VCCLCompilerTool"1810 UsePrecompiledHeader="0"1811 />1812 </FileConfiguration>1813 <FileConfiguration1814 Name="Debug-MemCheck|x64"1815 >1816 <Tool1817 Name="VCCLCompilerTool"1818 UsePrecompiledHeader="0"1819 />1820 </FileConfiguration>1821 <FileConfiguration1822 Name="OP5|Win32"1823 >1824 <Tool1825 Name="VCCLCompilerTool"1826 UsePrecompiledHeader="0"1827 />1828 </FileConfiguration>1829 <FileConfiguration1830 Name="OP5|x64"1831 >1832 <Tool1833 Name="VCCLCompilerTool"1834 UsePrecompiledHeader="0"1835 />1836 </FileConfiguration>1837 </File>1838 <File1839 1739 RelativePath=".\stdafx.cpp" 1840 1740 > … … 2177 2077 UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" 2178 2078 > 2079 </Filter> 2080 <Filter 2081 Name="PDH" 2082 > 2083 <File 2084 RelativePath="..\..\include\pdh\basic_impl.cpp" 2085 > 2086 <FileConfiguration 2087 Name="Debug|Win32" 2088 > 2089 <Tool 2090 Name="VCCLCompilerTool" 2091 UsePrecompiledHeader="0" 2092 /> 2093 </FileConfiguration> 2094 <FileConfiguration 2095 Name="Debug|x64" 2096 > 2097 <Tool 2098 Name="VCCLCompilerTool" 2099 UsePrecompiledHeader="0" 2100 /> 2101 </FileConfiguration> 2102 <FileConfiguration 2103 Name="Release|Win32" 2104 > 2105 <Tool 2106 Name="VCCLCompilerTool" 2107 UsePrecompiledHeader="0" 2108 /> 2109 </FileConfiguration> 2110 <FileConfiguration 2111 Name="Release|x64" 2112 > 2113 <Tool 2114 Name="VCCLCompilerTool" 2115 UsePrecompiledHeader="0" 2116 /> 2117 </FileConfiguration> 2118 <FileConfiguration 2119 Name="Distribution|Win32" 2120 > 2121 <Tool 2122 Name="VCCLCompilerTool" 2123 UsePrecompiledHeader="0" 2124 /> 2125 </FileConfiguration> 2126 <FileConfiguration 2127 Name="Distribution|x64" 2128 > 2129 <Tool 2130 Name="VCCLCompilerTool" 2131 UsePrecompiledHeader="0" 2132 /> 2133 </FileConfiguration> 2134 <FileConfiguration 2135 Name="Nightly|Win32" 2136 > 2137 <Tool 2138 Name="VCCLCompilerTool" 2139 UsePrecompiledHeader="0" 2140 /> 2141 </FileConfiguration> 2142 <FileConfiguration 2143 Name="Nightly|x64" 2144 > 2145 <Tool 2146 Name="VCCLCompilerTool" 2147 UsePrecompiledHeader="0" 2148 /> 2149 </FileConfiguration> 2150 <FileConfiguration 2151 Name="Debug-MemCheck|Win32" 2152 > 2153 <Tool 2154 Name="VCCLCompilerTool" 2155 UsePrecompiledHeader="0" 2156 /> 2157 </FileConfiguration> 2158 <FileConfiguration 2159 Name="Debug-MemCheck|x64" 2160 > 2161 <Tool 2162 Name="VCCLCompilerTool" 2163 UsePrecompiledHeader="0" 2164 /> 2165 </FileConfiguration> 2166 <FileConfiguration 2167 Name="OP5|Win32" 2168 > 2169 <Tool 2170 Name="VCCLCompilerTool" 2171 UsePrecompiledHeader="0" 2172 /> 2173 </FileConfiguration> 2174 <FileConfiguration 2175 Name="OP5|x64" 2176 > 2177 <Tool 2178 Name="VCCLCompilerTool" 2179 UsePrecompiledHeader="0" 2180 /> 2181 </FileConfiguration> 2182 </File> 2183 <File 2184 RelativePath="..\..\include\pdh\basic_impl.hpp" 2185 > 2186 </File> 2187 <File 2188 RelativePath="..\..\include\pdh\collectors.hpp" 2189 > 2190 </File> 2191 <File 2192 RelativePath="..\..\include\pdh\core.cpp" 2193 > 2194 <FileConfiguration 2195 Name="Debug|Win32" 2196 > 2197 <Tool 2198 Name="VCCLCompilerTool" 2199 UsePrecompiledHeader="0" 2200 /> 2201 </FileConfiguration> 2202 <FileConfiguration 2203 Name="Debug|x64" 2204 > 2205 <Tool 2206 Name="VCCLCompilerTool" 2207 UsePrecompiledHeader="0" 2208 /> 2209 </FileConfiguration> 2210 <FileConfiguration 2211 Name="Release|Win32" 2212 > 2213 <Tool 2214 Name="VCCLCompilerTool" 2215 UsePrecompiledHeader="0" 2216 /> 2217 </FileConfiguration> 2218 <FileConfiguration 2219 Name="Release|x64" 2220 > 2221 <Tool 2222 Name="VCCLCompilerTool" 2223 UsePrecompiledHeader="0" 2224 /> 2225 </FileConfiguration> 2226 <FileConfiguration 2227 Name="Distribution|Win32" 2228 > 2229 <Tool 2230 Name="VCCLCompilerTool" 2231 UsePrecompiledHeader="0" 2232 /> 2233 </FileConfiguration> 2234 <FileConfiguration 2235 Name="Distribution|x64" 2236 > 2237 <Tool 2238 Name="VCCLCompilerTool" 2239 UsePrecompiledHeader="0" 2240 /> 2241 </FileConfiguration> 2242 <FileConfiguration 2243 Name="Nightly|Win32" 2244 > 2245 <Tool 2246 Name="VCCLCompilerTool" 2247 UsePrecompiledHeader="0" 2248 /> 2249 </FileConfiguration> 2250 <FileConfiguration 2251 Name="Nightly|x64" 2252 > 2253 <Tool 2254 Name="VCCLCompilerTool" 2255 UsePrecompiledHeader="0" 2256 /> 2257 </FileConfiguration> 2258 <FileConfiguration 2259 Name="Debug-MemCheck|Win32" 2260 > 2261 <Tool 2262 Name="VCCLCompilerTool" 2263 UsePrecompiledHeader="0" 2264 /> 2265 </FileConfiguration> 2266 <FileConfiguration 2267 Name="Debug-MemCheck|x64" 2268 > 2269 <Tool 2270 Name="VCCLCompilerTool" 2271 UsePrecompiledHeader="0" 2272 /> 2273 </FileConfiguration> 2274 <FileConfiguration 2275 Name="OP5|Win32" 2276 > 2277 <Tool 2278 Name="VCCLCompilerTool" 2279 UsePrecompiledHeader="0" 2280 /> 2281 </FileConfiguration> 2282 <FileConfiguration 2283 Name="OP5|x64" 2284 > 2285 <Tool 2286 Name="VCCLCompilerTool" 2287 UsePrecompiledHeader="0" 2288 /> 2289 </FileConfiguration> 2290 </File> 2291 <File 2292 RelativePath="..\..\include\pdh\core.hpp" 2293 > 2294 </File> 2295 <File 2296 RelativePath="..\..\include\pdh\counters.hpp" 2297 > 2298 </File> 2299 <File 2300 RelativePath="..\..\include\pdh\enumerations.hpp" 2301 > 2302 </File> 2303 <File 2304 RelativePath="..\..\include\pdh\query.hpp" 2305 > 2306 </File> 2307 <File 2308 RelativePath="..\..\include\pdh\resolver.hpp" 2309 > 2310 </File> 2311 <File 2312 RelativePath="..\..\include\pdh\thread_Safe_impl.hpp" 2313 > 2314 </File> 2179 2315 </Filter> 2180 2316 <File -
branches/stable/modules/DebugLogMetrics/Jamfile
r172 r240 1 1 local target = A_DebugLogMetrics ; 2 2 local source = DebugLogMetrics ; 3 4 project5 : requirements6 <find-static-library>Pdh7 ;8 3 9 4 lib $(target) … … 13 8 PDHCollector.cpp 14 9 ../../include/NSCHelper.cpp 15 ../../include/PDHCounter.cpp16 10 ../../include/arrayBuffer.cpp 11 ../../include/pdh/basic_impl.cpp 12 ../../include/pdh/core.cpp 17 13 18 14 : # requirements -
branches/stable/modules/DebugLogMetrics/PDHCollector.cpp
r173 r240 22 22 #include <Settings.h> 23 23 #include <sysinfo.h> 24 #include <pdh/enumerations.hpp> 24 25 25 26 … … 59 60 // Open counters via .defs file or index. 60 61 try { 61 std::wstring process_counter_name = pdh.lookupIndex(230);62 std::wstring process_counter_name = PDH::PDHResolver::lookupIndex(230); 62 63 PDH::Enumerations::pdh_object_details list = PDH::Enumerations::EnumObjectInstances(process_counter_name); 63 64 int count = 0; … … 69 70 PDHCollectors::StaticPDHCounterListener<unsigned int, PDHCollectors::format_long, PDHCollectors::PDHCounterNormalMutex> *pid_list = 70 71 new PDHCollectors::StaticPDHCounterListener<unsigned int, PDHCollectors::format_long, PDHCollectors::PDHCounterNormalMutex>[count]; 71 std::wstring name = _T("\\") + process_counter_name + _T("(") + process_name_ + _T(")\\") + pdh.lookupIndex(784);72 std::wstring name = _T("\\") + process_counter_name + _T("(") + process_name_ + _T(")\\") + PDH::PDHResolver::lookupIndex(784); 72 73 NSC_DEBUG_MSG_STD(_T("Adding counter: ") + name); 73 74 pdh.addCounter(name, &pid_list[0]); 74 75 for (int i=1;i<count;i++) { 75 name = _T("\\") + process_counter_name + _T("(") + process_name_ + _T("#") + strEx::itos(i) + _T(")\\") + pdh.lookupIndex(784);76 name = _T("\\") + process_counter_name + _T("(") + process_name_ + _T("#") + strEx::itos(i) + _T(")\\") + PDH::PDHResolver::lookupIndex(784); 76 77 NSC_DEBUG_MSG_STD(_T("Adding counter: ") + name); 77 78 pdh.addCounter(name, &pid_list[i]); … … 110 111 list_.push_back(new pdh_value(184)); 111 112 112 std::wstring base_name = _T("\\") + pdh.lookupIndex(230) + _T("(") + my_process_name + _T(")\\");113 std::wstring base_name = _T("\\") + PDH::PDHResolver::lookupIndex(230) + _T("(") + my_process_name + _T(")\\"); 113 114 for (pdh_list::iterator it = list_.begin(); it != list_.end(); ++it) { 114 (*it)->key = pdh.lookupIndex((*it)->index);115 (*it)->key = PDH::PDHResolver::lookupIndex((*it)->index); 115 116 std::wstring name = base_name + (*it)->key; 116 117 NSC_DEBUG_MSG_STD(_T("Adding counter: ") + name); -
branches/stable/modules/DebugLogMetrics/PDHCollector.h
r170 r240 21 21 #pragma once 22 22 23 #include "PDHCollectors.h" 23 #include <pdh/collectors.hpp> 24 #include <pdh/query.hpp> 24 25 #include <thread.h> 25 26 #include <MutexRW.h>
Note: See TracChangeset
for help on using the changeset viewer.







