build number updated
authorVictor Kirhenshtein <victor@netxms.org>
Wed, 16 Dec 2015 13:59:57 +0000 (09:59 -0400)
committerVictor Kirhenshtein <victor@netxms.org>
Wed, 16 Dec 2015 13:59:57 +0000 (09:59 -0400)
12 files changed:
android/src/agent/res/values/build_number.xml
android/src/console/res/values/build_number.xml
build/build_number
include/build.h
src/agent/install/nxagent-x64.iss
src/agent/install/setup.iss
src/agent/subagents/winperf/tools.cpp
src/agent/subagents/winperf/winperf.cpp
src/agent/subagents/winperf/winperf.h
src/java/build/set_build_number.cmd
src/java/build/set_build_number.sh
src/java/client/netxms-base/src/main/java/org/netxms/base/BuildNumber.java

index 1be5d7c..6431b78 100644 (file)
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-       <string name="build_number">8051</string>
+       <string name="build_number">8053</string>
 </resources>
index 1be5d7c..6431b78 100644 (file)
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-       <string name="build_number">8051</string>
+       <string name="build_number">8053</string>
 </resources>
index 4d29dae..2afb301 100644 (file)
@@ -1 +1 @@
-8051
+8053
index 9b6e799..257283a 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef __build_h
 #define __build_h
-#define NETXMS_VERSION_BUILD 8051
-#define NETXMS_VERSION_BUILD_STRING _T("8051")
+#define NETXMS_VERSION_BUILD 8053
+#define NETXMS_VERSION_BUILD_STRING _T("8053")
 #endif
index aa9ef2d..c49244e 100644 (file)
@@ -3,7 +3,7 @@
 
 [Setup]
 #include "setup.iss"
-OutputBaseFilename=nxagent-2.0-RC2-x64
+OutputBaseFilename=nxagent-2.0-RC2-8052-x64
 ArchitecturesInstallIn64BitMode=x64
 ArchitecturesAllowed=x64
 
index e81c420..b560bc4 100644 (file)
@@ -1,6 +1,6 @@
 AppName=NetXMS Agent
-AppVerName=NetXMS Agent 2.0-RC2
-AppVersion=2.0-RC2
+AppVerName=NetXMS Agent 2.0-RC2-8052
+AppVersion=2.0-RC2-8052
 AppPublisher=Raden Solutions
 AppPublisherURL=http://www.radensolutions.com
 AppSupportURL=http://www.netxms.org
index 69fa597..eedd56f 100644 (file)
@@ -30,8 +30,7 @@
 /**
  * List of configured counters
  */
-static COUNTER_INDEX *m_pCounterList = NULL;
-static DWORD m_dwNumCounters = 0;
+static StructArray<COUNTER_INDEX> m_counterIndexes;
 
 /**
  * Get error text for PDH functions
@@ -75,36 +74,62 @@ void ReportPdhError(TCHAR *pszFunction, TCHAR *pszPdhCall, PDH_STATUS dwError)
 /**
  * Create index of counters
  */
-void CreateCounterIndex(TCHAR *pData)
+void CreateCounterIndex(TCHAR *englishCounters, TCHAR *localCounters)
 {
-       for(TCHAR *pCurr = pData; *pCurr != 0; )
+       for(TCHAR *curr = englishCounters; *curr != 0; )
        {
-               m_pCounterList = (COUNTER_INDEX *)realloc(m_pCounterList, sizeof(COUNTER_INDEX) * (m_dwNumCounters + 1));
-               m_pCounterList[m_dwNumCounters].dwIndex = _tcstoul(pCurr, NULL, 10);
-               pCurr += _tcslen(pCurr) + 1;
-               m_pCounterList[m_dwNumCounters].pszName = _tcsdup(pCurr);
-               pCurr += _tcslen(pCurr) + 1;
-               m_dwNumCounters++;
+      COUNTER_INDEX ci;
+               ci.index = _tcstoul(curr, NULL, 10);
+               curr += _tcslen(curr) + 1;
+               ci.englishName = _tcsdup(curr);
+               curr += _tcslen(curr) + 1;
+      ci.localName = NULL;
+      m_counterIndexes.add(&ci);
        }
-   AgentWriteDebugLog(2, _T("WinPerf: %d counter indexes read"), m_dwNumCounters);
+   AgentWriteDebugLog(2, _T("WinPerf: %d counter indexes read"), m_counterIndexes.size());
+
+   int translations = 0;
+       for(TCHAR *curr = localCounters; *curr != 0; )
+       {
+               DWORD index = _tcstoul(curr, NULL, 10);
+               curr += _tcslen(curr) + 1;
+      for(int i = 0; i < m_counterIndexes.size(); i++)
+      {
+         COUNTER_INDEX *ci = m_counterIndexes.get(i);
+         if (ci->index == index)
+         {
+            ci->localName = _tcsdup(curr);
+            translations++;
+            break;
+         }
+      }
+               curr += _tcslen(curr) + 1;
+       }
+   AgentWriteDebugLog(2, _T("WinPerf: %d counter translations read"), translations);
+
 }
 
 /**
  * Translate single counter name's element
  */
-static BOOL TranslateElement(TCHAR *pszText)
+static bool TranslateElement(TCHAR *name)
 {
-       DWORD i, dwSize;
-
-       for(i = 0; i < m_dwNumCounters; i++)
+   for(int i = 0; i < m_counterIndexes.size(); i++)
        {
-               if (!_tcsicmp(m_pCounterList[i].pszName, pszText))
+      COUNTER_INDEX *ci = m_counterIndexes.get(i);
+      if (!_tcsicmp(ci->englishName, name))
                {
-                       dwSize = MAX_ELEMENT_LENGTH * sizeof(TCHAR);
-                       return PdhLookupPerfNameByIndex(NULL, m_pCounterList[i].dwIndex, pszText, &dwSize) == ERROR_SUCCESS;
+         if (ci->localName != NULL)
+         {
+            _tcscpy(name, ci->localName);
+            return true;
+         }
+                       
+         DWORD size = MAX_ELEMENT_LENGTH * sizeof(TCHAR);
+                       return PdhLookupPerfNameByIndex(NULL, ci->index, name, &size) == ERROR_SUCCESS;
                }
        }
-       return FALSE;
+       return false;
 }
 
 /**
@@ -115,7 +140,7 @@ BOOL TranslateCounterName(const TCHAR *pszName, TCHAR *pszOut)
        const TCHAR *pCurr = pszName;
        const TCHAR *pSlash, *pBrace, *pNext;
        TCHAR szTemp[MAX_ELEMENT_LENGTH];
-       BOOL bs1, bs2;
+       bool bs1, bs2;
        int nLen;
 
        // Generic counter name looks like following:
index 47c9c16..caed33e 100644 (file)
@@ -543,22 +543,44 @@ DECLARE_SUBAGENT_ENTRY_POINT(WINPERF)
       {
              DWORD bytes = (DWORD)countersBufferSize;
          DWORD type;
-             status = RegQueryValueEx(HKEY_PERFORMANCE_DATA, _T("Counter"), NULL, &type, (BYTE *)counters, &bytes);
+             status = RegQueryValueEx(hKey, _T("Counter"), NULL, &type, (BYTE *)counters, &bytes);
              while(status == ERROR_MORE_DATA)
              {
                      countersBufferSize += 8192;
                      counters = (TCHAR *)realloc(counters, countersBufferSize);
                      bytes = (DWORD)countersBufferSize;
-             status = RegQueryValueEx(HKEY_PERFORMANCE_DATA, _T("Counter"), NULL, &type, (BYTE *)counters, &bytes);
+             status = RegQueryValueEx(hKey, _T("Counter"), NULL, &type, (BYTE *)counters, &bytes);
              }
          RegCloseKey(hKey);
       }
    }
        if (status == ERROR_SUCCESS)
        {
-               CreateCounterIndex(counters);
+          countersBufferSize = 8192;
+          TCHAR *localCounters = (TCHAR *)malloc(countersBufferSize);
+      localCounters[0] = 0;
+
+      HKEY hKey;
+      status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib\\CurrentLanguage"), 0, KEY_READ, &hKey);
+      if (status == ERROR_SUCCESS)
+      {
+             DWORD bytes = (DWORD)countersBufferSize;
+         DWORD type;
+             status = RegQueryValueEx(hKey, _T("Counter"), NULL, &type, (BYTE *)localCounters, &bytes);
+             while(status == ERROR_MORE_DATA)
+             {
+                     countersBufferSize += 8192;
+                     localCounters = (TCHAR *)realloc(localCounters, countersBufferSize);
+                     bytes = (DWORD)countersBufferSize;
+             status = RegQueryValueEx(hKey, _T("Counter"), NULL, &type, (BYTE *)localCounters, &bytes);
+             }
+         RegCloseKey(hKey);
+      }
+
+               CreateCounterIndex(counters, localCounters);
+      free(localCounters);
        }
-       safe_free(counters);
+       free(counters);
 
    // Init parameters list
    m_info.numParameters = sizeof(m_parameters) / sizeof(NETXMS_SUBAGENT_PARAM);
index 368a948..ec8e4bc 100644 (file)
@@ -96,14 +96,15 @@ public:
  */
 struct COUNTER_INDEX
 {
-       DWORD dwIndex;
-       TCHAR *pszName;
+       DWORD index;
+       TCHAR *englishName;
+       TCHAR *localName;
 };
 
 /**
  * Functions
  */
-void CreateCounterIndex(TCHAR *pData);
+void CreateCounterIndex(TCHAR *engilshCounters, TCHAR *localCounters);
 BOOL TranslateCounterName(const TCHAR *pszName, TCHAR *pszOut);
 int CheckCounter(const TCHAR *pszName, TCHAR **ppszNewName);
 void StartCollectorThreads();
index d398dcd..c2d21ab 100644 (file)
@@ -1,5 +1,5 @@
 package org.netxms.base;
 public final class BuildNumber {
-   public static final String TEXT = "8051";
-   public static final int NUMBER = 8051;
+   public static final String TEXT = "8053";
+   public static final int NUMBER = 8053;
 }