I'm using gnu parallel that reads a text file containing curl commands.
If I do ps -ef | grep -cw [c]url
it shows total number of curl process at a moment.
But I want to know number of gnu parallel jobs running in each CPU core.
How to find that?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityI'm using gnu parallel that reads a text file containing curl commands.
If I do ps -ef | grep -cw [c]url
it shows total number of curl process at a moment.
But I want to know number of gnu parallel jobs running in each CPU core.
How to find that?
Taking the question literally I do not see a way you can do that: A process may run 1 ms on one core and the next ms it runs on another core.
Your comment is, however, easy to answer:
I wanna ensure all cores are involved. How do I verify that?
htop
This shows all cores are busy:
1 [|||||93.0%] 17 [|||||97.3%] 33 [|||||87.1%] 49 [|||||91.0%]
2 [|||||95.3%] 18 [|||||98.5%] 34 [|||||91.4%] 50 [|||||92.5%]
3 [|||||93.7%] 19 [|||||96.9%] 35 [|||||87.4%] 51 [|||||91.3%]
4 [|||||90.2%] 20 [|||||96.2%] 36 [|||||92.1%] 52 [|||||94.9%]
5 [|||||95.3%] 21 [|||||97.3%] 37 [|||||87.6%] 53 [|||||90.7%]
6 [|||||95.3%] 22 [|||||97.3%] 38 [|||||92.0%] 54 [|||||93.4%]
7 [|||||91.7%] 23 [|||||97.7%] 39 [|||||86.7%] 55 [|||||94.2%]
8 [|||||92.5%] 24 [|||||98.4%] 40 [|||||93.3%] 56 [|||||91.8%]
9 [|||||97.3%] 25 [|||||97.7%] 41 [|||||93.8%] 57 [|||||92.9%]
10 [|||||97.7%] 26 [|||||96.9%] 42 [|||||94.9%] 58 [|||||93.5%]
11 [|||||97.7%] 27 [|||||98.4%] 43 [|||||95.3%] 59 [|||||90.8%]
12 [|||||97.3%] 28 [|||||97.7%] 44 [|||||95.3%] 60 [|||||91.3%]
13 [|||||96.5%] 29 [|||||97.3%] 45 [|||||95.7%] 61 [|||||93.2%]
14 [|||||97.7%] 30 [|||||97.7%] 46 [|||||95.3%] 62 [|||||93.3%]
15 [|||||97.7%] 31 [|||||97.7%] 47 [|||||94.5%] 63 [|||||92.6%]
16 [|||||96.9%] 32 [|||||95.7%] 48 [|||||94.0%] 64 [|||||94.9%]
Avg[||||||||||||||||||||||||94.5%] Tasks: 302, 10084 thr; 39 running
Mem[||| 10.1G/504G] Load average: 119.46 47.95 29.59
Swp[ 0K/0K] Uptime: 00:17:23
PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command
2457 vcache 20 0 4985M 1284M 86536 S 440. 0.2 10:54.69 /usr/sbin/varn
351883 www-data 20 0 1954M 11736 3748 S 142. 0.0 1:20.80 /usr/sbin/apac
433876 www-data 20 0 1953M 11392 3748 S 132. 0.0 0:29.07 /usr/sbin/apac
411605 www-data 20 0 1889M 11424 3748 S 99.0 0.0 0:40.96 /usr/sbin/apac
2466 varnishlo 20 0 87080 84156 83468 S 42.6 0.0 1:07.94 /usr/bin/varni
371877 tange 20 0 15916 11136 3500 R 40.3 0.0 0:24.92 htop
372227 tange 20 0 25960 19820 5688 D 33.2 0.0 0:15.86 perl /usr/loca
372060 tange 20 0 25912 19816 5692 D 32.5 0.0 0:15.21 perl /usr/loca
F1Help F2Setup F3SearchF4FilterF5Tree F6SortByF7Nice -F8Nice +F9Kill F10Quit
This shows an idle machine:
1 [| 0.5%] 17 [ 0.0%] 33 [ 0.0%] 49 [ 0.0%]
2 [ 0.0%] 18 [ 0.0%] 34 [ 0.0%] 50 [ 0.0%]
3 [ 0.0%] 19 [ 0.0%] 35 [ 0.0%] 51 [ 0.0%]
4 [ 0.0%] 20 [ 0.0%] 36 [ 0.0%] 52 [ 0.0%]
5 [ 0.0%] 21 [| 0.5%] 37 [ 0.0%] 53 [ 0.0%]
6 [ 0.0%] 22 [ 0.0%] 38 [ 0.0%] 54 [ 0.0%]
7 [ 0.0%] 23 [ 0.0%] 39 [ 0.0%] 55 [ 0.0%]
8 [|||| 29.6%] 24 [ 0.0%] 40 [ 0.0%] 56 [ 0.0%]
9 [| 0.5%] 25 [| 0.5%] 41 [| 0.5%] 57 [| 0.9%]
10 [ 0.0%] 26 [| 0.5%] 42 [ 0.0%] 58 [| 0.5%]
11 [ 0.0%] 27 [|| 0.9%] 43 [ 0.0%] 59 [| 0.9%]
12 [ 0.0%] 28 [| 0.5%] 44 [ 0.0%] 60 [| 0.5%]
13 [ 0.0%] 29 [| 0.5%] 45 [| 0.5%] 61 [| 0.9%]
14 [ 0.0%] 30 [| 0.5%] 46 [| 0.5%] 62 [| 0.9%]
15 [ 0.0%] 31 [| 0.5%] 47 [| 0.5%] 63 [|| 1.4%]
16 [ 0.0%] 32 [| 0.5%] 48 [ 0.0%] 64 [| 0.9%]
Avg[|| 0.7%] Tasks: 132, 10350 thr; 1 running
Mem[||| 7.15G/504G] Load average: 1.02 21.86 20.72
Swp[ 0K/0K] Uptime: 00:15:10
PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command
2457 vcache 20 0 4913M 1191M 86520 S 0.5 0.2 7:02.69 /usr/sbin/varn
3023 mysql 20 0 2092M 377M 35696 S 0.5 0.1 0:00.50 /usr/sbin/mysq
4217 root 20 0 2366M 44548 19464 S 0.5 0.0 0:00.12 /usr/lib/snapd
371811 root 20 0 23436 5048 1892 S 0.0 0.0 0:00.03 /lib/systemd/s
371814 root 20 0 23436 5048 1892 S 0.0 0.0 0:00.03 /lib/systemd/s
371816 root 20 0 23436 5048 1892 S 0.0 0.0 0:00.03 /lib/systemd/s
371817 root 20 0 23436 5048 1892 S 0.0 0.0 0:00.03 /lib/systemd/s
371818 root 20 0 23436 5048 1892 S 0.0 0.0 0:00.03 /lib/systemd/s
F1Help F2Setup F3SearchF4FilterF5Tree F6SortByF7Nice -F8Nice +F9Kill F10Quit
That number is 0 or 1. A CPU core can only execute one program at a time.
xargs
:) honestly, will still not happen, but if you could go to my answer there and comment on it, what you took from it (and what not), it would certainly make my day.
Jan 7 at 22:40