Thread: Multi cores
View Single Post
  #7   (View Single Post)  
Old 12th December 2014
Oko's Avatar
Oko Oko is offline
Rc.conf Instructor
 
Join Date: May 2008
Location: Kosovo, Serbia
Posts: 1,102
Default

Quote:
Originally Posted by muflon View Post
First of all; in NetBSD there is fine tool called: cpuctl [man (8) cpuctl] to control and inspect the state of CPUs in the system.

Example [1]
To list the current processors/cores;
Code:
argus# cpuctl list
Num  HwId Unbound LWPs Interrupts Last change              #Intr
---- ---- ------------ ---------- ------------------------ -----
0    0    online       intr       Fri Dec 12 10:22:27 2014 12
1    1    online       intr       Fri Dec 12 10:22:27 2014 0
Example [2]
Identification of the cpu info printed on the list of example [1]
Code:
argus# cpuctl identify 0
cpu0: Intel (686-class), 2800.22 MHz, id 0xf34
cpu0: features  0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR>
cpu0: features  0xbfebfbff<PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR>
cpu0: features  0xbfebfbff<SSE,SSE2,SS,HTT,TM,SBF>
cpu0: features2 0x441d<SSE3,DTES64,MONITOR,DS-CPL,CID,xTPR>
cpu0: "Intel(R) Pentium(R) 4 CPU 2.80GHz"
cpu0: I-cache 12K uOp cache 8-way, D-cache 16KB 64B/line 8-way
cpu0: L2 cache 1MB 64B/line 8-way
cpu0: ITLB 4K/4M: 64 entries
cpu0: DTLB 4K/4M: 64 entries
cpu0: Initial APIC ID 0
cpu0: Cluster/Package ID 0
cpu0: SMT ID 0
cpu0: family 0f model 03 extfamily 00 extmodel 00 stepping 04
cpu0: UCode version: ?
Example [3]
Turning ON or OFF exact cpu/core:

Code:
argus# cpuctl list
Num  HwId Unbound LWPs Interrupts Last change              #Intr
---- ---- ------------ ---------- ------------------------ -----
0    0    online       intr       Fri Dec 12 10:22:27 2014 12
1    1    online       intr       Fri Dec 12 10:22:27 2014 0

argus# cpuctl offline 0

argus# cpuctl list

Num  HwId Unbound LWPs Interrupts Last change              #Intr
---- ---- ------------ ---------- ------------------------ -----
0    0    offline      intr       Fri Dec 12 12:37:32 2014 12
1    1    online       intr       Fri Dec 12 10:22:27 2014 0
Code:
76 processes: 1 runnable, 60 sleeping, 13 stopped, 2 on CPU
CPU0 states:  0.0% user,  0.0% nice,  0.0% system,  0.0% interrupt,  100% idle
CPU1 states: 89.4% user,  0.0% nice, 10.2% system,  0.0% interrupt,  0.4% idle
Memory: 2227M Act, 111M Inact, 6188K Wired, 16M Exec, 2279M File, 486M Free
Swap: 3073M Total, 3073M Free

  PID USERNAME PRI NICE   SIZE   RES STATE      TIME   WCPU    CPU COMMAND
  966 root      85    0  4452K 3376K kqueue/1   1:57  0.44%  0.44% tmux
    0 root       0    0     0K   19M CPU/0      2:05  0.00%  0.00% [system]
 2415 root      43    0  3368K 1652K CPU/1      0:00  0.00%  0.00% top
24632 root      35    0    15M   10M RUN/1      0:00  0.00%  0.00% cc1
  252 root      85    0  6036K 6208K pause/1    0:00  0.00%  0.00% ntpd
18263 root      85    0    10M 4432K select/1   0:00  0.00%  0.00% sshd
 4377 root      85    0  5156K 3440K wait/1     0:00  0.00%  0.00% make
Above presentation was done on my Dell PowerEdge 750; with Pentium 4 Prescott with HT Enable, running on NetBSD 6.1_CURRENT; during compilation of qemu from pkgsrc. You can see the TOP listing; that the cpu Nr 0 is offline and it's state is 100% idle.


And; last but not least; recommendation to read an article about the Thread scheduling and related interfaces in NetBSD 5.0 written by Mindaugas Rasiukevicius.

Salute,
Marcin
Really cool post!!! I personally was not aware of this work.
Reply With Quote