QCAD

QCAD - 2D CAD System.

Click here for a documentation of the DokuWiki formatting syntax that can be used in reports

Please search for existing tasks (also closed ones) before opening a new task.

Please make sure that you are using the latest Version of QCAD before posting a bug (menu Help - Check for Updates)

Tasklist

FS#1056 - Dead and wrong code in RSPlatform.cpp

Attached to Project: QCAD
Opened by Tamas TEVESZ (kazmer) - Friday, 23 May 2014, 13:26 GMT+1
Last edited by Andrew (andrew) - Friday, 23 May 2014, 13:30 GMT+1
Task Type Refactoring
Category Main
Status Assigned
Assigned To Andrew (andrew)
Operating System All
Severity Low
Priority Normal
Reported Version 3.5.1
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

I am considering pushing the following diff:

--- a/src/core/RSPlatform.cpp
+++ b/src/core/RSPlatform.cpp
@@ -205,25 +205,6 @@ int RS::getCpuCores() {
     cores = sysinfo.dwNumberOfProcessors;
 #elif defined(Q_OS_UNIX)
     cores = sysconf( _SC_NPROCESSORS_ONLN );
-#elif defined (Q_OS_MAC) || defined (Q_OS_BSD4) || [...]
-    nt mib[4];
-    size_t len;
-
-    /* set the mib for hw.ncpu */
-    mib[0] = CTL_HW;
-    mib[1] = HW_AVAILCPU; // alternatively, try HW_NCPU;
-
-    /* get the number of CPUs from the system */
-    sysctl(mib, 2, &cores, &len, NULL, 0);
-
-    if (cores < 1) {
-        mib[1] = HW_NCPU;
-        sysctl( mib, 2, &cores, &len, NULL, 0 );
-    }
-#elif defined(Q_OS_HPUX)
-    cores = mpctl(MPC_GETNUMSPUS, NULL, NULL);
-#elif defined(Q_OS_IRIX)
-    cores = sysconf( _SC_NPROC_ONLN );
 #endif

(truncated list to manage size)

I see that most of this was put in there as a kind of a note-to-self originally, however _SC_NPROCESSORS_ONLN is implemented by every realistically possible targets anyway, so for all practical purposes, this is dead weight.

A couple of questions remain, though:

  • #ifdef Q_OS_WIN32 should probably be Q_OS_WIN, so as to include win64 as well.
  • Assuming the real purpose for this function is to determine how many parts a particular task is to be split into in the future, if and when QCAD gets the need to split expensive tasks among multiple CPUS, “core” probably shouldn’t be static - CPUs are hot-pluggable today, and while one probably doesn’t do that on a laptop, it’s not unfeasible in, say, a VDI environment.

Thoughts?

This task depends upon

Loading...