QCAD Bugtracker

  • Status Closed
  • Percent Complete
    100%
  • Task Type Refactoring
  • Category QCAD (main)
  • Assigned To
    Andrew
  • Operating System All
  • Severity Very Low
  • Priority Defer
  • Reported Version 3.5.1
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: QCAD Bugtracker
Opened by Tamas TEVESZ - 23.05.2014
Last edited by Andrew - 05.10.2018

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

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?

Closed by  Andrew
05.10.2018 09:29
Reason for closing:  Won't implement

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing