Browse Source

Changes following review

1) Use elapsedCycles for efficiency (and static calc. of 1 sec in cycles)
2) Add memorySpillAt to thor.xsd
3) handle memorySpillAt of 0

Signed-off-by: Jake Smith <jake.smith@lexisnexis.com>
Jake Smith 12 years ago
parent
commit
7547d0066a

+ 7 - 0
initfiles/componentfiles/configxml/thor.xsd.in

@@ -354,6 +354,13 @@
           </xs:appinfo>
         </xs:annotation>
       </xs:attribute>
+      <xs:attribute name="memorySpillAt" type="xs:nonNegativeInteger" use="optional">
+        <xs:annotation>
+          <xs:appinfo>
+            <tooltip>Threshold that the memory manager should start requesting memory to be freed (percentage)</tooltip>
+          </xs:appinfo>
+        </xs:annotation>
+      </xs:attribute>
       <xs:attribute name="pluginsPath" type="relativePath" default="${PLUGINS_PATH}/"/>
       <xs:attribute name="nodeGroup" type="xs:string" use="optional">
         <xs:annotation>

+ 7 - 6
thorlcr/activities/hashdistrib/thhashdistribslave.cpp

@@ -536,6 +536,7 @@ public:
     {
         CCycleTimer timer;
         MemoryBuffer tempMb;
+        static cycle_t oneSec = nanosec_to_cycle(1000000000);
         try {
             ActPrintLog(activity, "Read loop start");
             CMessageBuffer recvMb;
@@ -569,14 +570,14 @@ public:
                         {
                             timer.reset();
                             const void *row = ptrallocator.deserializeRow(allocator,rowSource);
-                            unsigned took=timer.elapsedMs();
-                            if (took>=1000)
-                                DBGLOG("RECVLOOP deserializeRow blocked for : %d second(s)", took/1000);
+                            cycle_t took=timer.elapsedCycles();
+                            if (took>=oneSec)
+                                DBGLOG("RECVLOOP deserializeRow blocked for : %d second(s)", (unsigned)(cycle_to_nanosec(took)/1000000000));
                             timer.reset();
                             pipewr->putRow(row);
-                            took=timer.elapsedMs();
-                            if (took>=1000)
-                                DBGLOG("RECVLOOP pipewr->putRow blocked for : %d second(s)", took/1000);
+                            took=timer.elapsedCycles();
+                            if (took>=oneSec)
+                                DBGLOG("RECVLOOP pipewr->putRow blocked for : %d second(s)", (unsigned)(cycle_to_nanosec(took)/1000000000));
                         }
                     }
                 }

+ 1 - 1
thorlcr/thorutil/thmem.cpp

@@ -1720,7 +1720,7 @@ public:
     CThorAllocator(memsize_t memSize, unsigned memorySpillAt, bool _usePacked) : usePacked(_usePacked)
     {
         rowManager.setown(roxiemem::createRowManager(memSize, NULL, queryDummyContextLogger(), this, false));
-        rowManager->setMemoryLimit(memSize, memSize/100*memorySpillAt);
+        rowManager->setMemoryLimit(memSize, 0==memorySpillAt ? 0 : memSize/100*memorySpillAt);
         rtlSetReleaseRowHook(this);
     }
     ~CThorAllocator()