src/worker.cc
// Use pthreads to prioritize a system thread.
Use pthreads to prioritize a system thread.
Use pthreads to prioritize a system thread .
bool WorkerThread::InitPriority() {
  bool ret = BindToCpus(&cpu_mask_);
  if (!ret)
    logprintf(11, "Log: Bind to %s failed.\n",
              cpuset_format(&cpu_mask_).c_str());
  logprintf(11, "Log: Thread %d running on apic ID %d mask %s (%s).\n",
            thread_num_, apicid(),
            CurrentCpusFormat().c_str(),
            cpuset_format(&cpu_mask_).c_str());
#if 0
  if (priority_ == High) {
    sched_param param;
    param.sched_priority = 1;
    logprintf(0, "Log: Changing priority to SCHED_FIFO %d\n",
              param.sched_priority);
    if (sched_setscheduler(0, SCHED_FIFO, &param)) {
      char buf[256];
      sat_strerror(errno, buf, sizeof(buf));
      logprintf(0, "Process Error: sched_setscheduler "
                   "failed - error %d %s\n",
                errno, buf);
    }
  }
#endif
  return true;
}
bool WorkerThread :: InitPriority ( ) { bool ret = BindToCpus ( & cpu_mask_ ) ; if ( ! ret ) logprintf ( 11 , " \n " , cpuset_format ( & cpu_mask_ ) . c_str ( ) ) ; logprintf ( 11 , " \n " , thread_num_ , apicid ( ) , CurrentCpusFormat ( ) . c_str ( ) , cpuset_format ( & cpu_mask_ ) . c_str ( ) ) ; #if 0 if ( priority_ == High ) { sched_param param ; param . sched_priority = 1 ; logprintf ( 0 , " \n " , param . sched_priority ) ; if ( sched_setscheduler ( 0 , SCHED_FIFO , & param ) ) { char buf [ 256 ] ; sat_strerror ( errno , buf , sizeof ( buf ) ) ; logprintf ( 0 , " " " \n " , errno , buf ) ; } } #endif return true ; }
Use pthreads to prioritize a system thread.
Use pthreads to prioritize a system thread .
// This doesn't affect performance that much, and may not be too safe. // Set the priority; others are unchanged.