我有一个在 ubuntu 中的 mono 4.0.1 上运行的 .net 应用程序。
该应用程序是多线程的,但在 4 核机器上 CPU 使用率不超过 25%。
我认为 mono 只是在其中一个核心上运行,并没有使用服务器上的所有 CPU 核心。
我运行了单声道分析器,请找到截断的输出
Monitor lock summary
Lock object 0x7f0a621b6f58: 21 contentions
0.000609 secs total wait time, 0.000049 max, 0.000029 average
Lock object 0x7f0a703c9270: 14 contentions
0.000311 secs total wait time, 0.000034 max, 0.000022 average
Lock object 0x7f0a74b8cbc8: 1 contentions
0.000023 secs total wait time, 0.000023 max, 0.000023 average
Lock object 0x7f0a703cae90: 1 contentions
0.000020 secs total wait time, 0.000020 max, 0.000020 average
Lock object 0x7f0a7489c4b0: 1 contentions
0.000017 secs total wait time, 0.000017 max, 0.000017 average
Lock object 0x7f0a703d5c00: 1 contentions
0.000017 secs total wait time, 0.000017 max, 0.000017 average
Lock object 0x7f0a74afdf60: 1 contentions
0.000012 secs total wait time, 0.000012 max, 0.000012 average
Lock object 0x7f0a74b21d60: 1 contentions
0.000010 secs total wait time, 0.000010 max, 0.000010 average
Lock object 0x7f0a74b21ac8: 1 contentions
0.000010 secs total wait time, 0.000010 max, 0.000010 average
Lock contentions: 42
Lock acquired: 42
Lock failures: 0
Thread summary
Thread: 0x7f0a711ff700, name: "Timer-Scheduler"
Thread: 0x7f0a604ff700, name: "Threadpool worker"
Thread: 0x7f0a635de700, name: "Threadpool worker"
Thread: 0x7f0a63dfe700, name: "Threadpool worker"
Thread: 0x7f0a63fff700, name: "Threadpool worker"
Thread: 0x7f0a71786700, name: "Finalizer"
Thread: 0x7f0a75ebb7c0, name: ""
Thread: (nil), name: "Main"
Counters:
Mono System:
User Time : 0.000ms
System Time : 20.000ms
Total Time : 0.000ms
Working Set : 9244672
Private Bytes : 168361984
Virtual Bytes : 214839296
Page Faults : 2742
CPU Load Average - 1min : 0.020000
CPU Load Average - 5min : 0.050000
CPU Load Average - 15min : 0.050000
Mono JIT:
Methods from AOT : 0
Methods JITted using mono JIT : 6
Methods JITted using LLVM : 0
Total time spent JITting (sec) : 0.000597
如何设置 mono 以使用服务器上的所有核心?这是服务器上唯一运行的进程。
谢谢
答案1
确保内核中使用 SMP(对称多处理)。如果您不知道如何操作,请使用 Google。