几个月前我注意到我的戴尔笔记本电脑 [Ubuntu 16.04] 突然变慢了,现在我发现这是在我将其从自己的扩展坞上拔下时发生的。这似乎与电源插座或没有互联网无关,因为我有同样的问题,例如当我在火车上工作时,笔记本电脑连接到插座上......这只是当它离开扩展坞时......请参阅以下控制台会话,我使用 Julia 对虚拟函数进行基准测试(问题不在 Julia 中......我在从 LaTeX 编译大型 pdf 时也遇到了其他计算密集型问题)。其他进程占用 CPU 或内存似乎没有任何问题。
$ julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.5.1 (2017-03-05 13:25 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-pc-linux-gnu
julia> function f(n)
s = 0
for i = 1:n
s += i/2
end
s
end
f (generic function with 1 method)
julia> @time f(100000000)
1.948031 seconds (300.00 M allocations: 4.470 GB, 14.57% gc time)
2.500000025e15
julia> @time f(100000000)
1.771005 seconds (300.00 M allocations: 4.470 GB, 7.27% gc time)
2.500000025e15
julia> @time f(100000000)
1.764294 seconds (300.00 M allocations: 4.470 GB, 7.00% gc time)
2.500000025e15
julia> @time f(100000000)
1.776455 seconds (300.00 M allocations: 4.470 GB, 7.06% gc time)
2.500000025e15
julia> @time f(100000000)
1.791494 seconds (300.00 M allocations: 4.470 GB, 7.12% gc time)
2.500000025e15
julia> @time f(100000000) # here I unplug the laptop from the docking station
11.927460 seconds (300.00 M allocations: 4.470 GB, 5.56% gc time)
2.500000025e15
julia> @time f(100000000)
12.201062 seconds (300.00 M allocations: 4.470 GB, 5.50% gc time)
2.500000025e15
julia> @time f(100000000) # here I plugged the power cord directly to the laptop
11.839180 seconds (300.00 M allocations: 4.470 GB, 5.62% gc time)
2.500000025e15
julia> @time f(100000000) # here I removed internet conection, including wifi
11.860953 seconds (300.00 M allocations: 4.470 GB, 5.65% gc time)
2.500000025e15
julia> @time f(100000000) # here I plugged back the laptop on the deck
11.789184 seconds (300.00 M allocations: 4.470 GB, 5.63% gc time)
2.500000025e15
julia> @time f(100000000) # here I switched the keyboqrd to English lqnguqge
11.857721 seconds (300.00 M allocations: 4.470 GB, 5.68% gc time)
2.500000025e15
julia> @time f(100000000) # here I closed the screen of the laptop and worked back on the main screen
12.001792 seconds (300.00 M allocations: 4.470 GB, 5.63% gc time)
2.500000025e15
julia> @time f(100000000) # here I am back to ethernet
11.865361 seconds (300.00 M allocations: 4.470 GB, 5.71% gc time)
2.500000025e15
julia> exit()
$ julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.5.1 (2017-03-05 13:25 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-pc-linux-gnu
julia> @time f(100000000) # here I went off and on Julia
ERROR: UndefVarError: f not defined
julia> function f(n)
s = 0
for i = 1:n
s += i/2
end
s
end
f (generic function with 1 method)
julia> @time f(100000000) # here I went off and on Julia
12.809319 seconds (300.00 M allocations: 4.470 GB, 11.16% gc time)
2.500000025e15
julia> @time f(100000000) # here after lot of time (lunch break)
11.916337 seconds (300.00 M allocations: 4.470 GB, 5.49% gc time)
2.500000025e15
julia> quit()
$ julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.5.1 (2017-03-05 13:25 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-pc-linux-gnu
julia> @time f(100000000) # here after suspended the pc and julia stop/restart
ERROR: UndefVarError: f not defined
julia> function f(n)
s = 0
for i = 1:n
s += i/2
end
s
end
f (generic function with 1 method)
julia> @time f(100000000) # here after suspended the pc and julia stop/restart
1.952593 seconds (300.00 M allocations: 4.470 GB, 14.26% gc time)
2.500000025e15
julia> @time f(100000000) # here after suspended the pc and julia stop/restart
1.824997 seconds (300.00 M allocations: 4.470 GB, 6.34% gc time)
2.500000025e15
julia>
编辑:以下记录显示了一些有趣的事情... 之前从扩展坞拔下电源时,我是在屏幕关闭的情况下进行的,现在我拔下电源时屏幕是打开的,这样它就可以工作了... 直到我拔下电源插头并执行挂起/恢复.. 然后它不工作了,然后我插上电源,执行挂起/恢复,它又可以正常工作了... 似乎它进入了低功耗模式,无论你是否重新插上电源都没关系,您还需要让笔记本电脑挂起/恢复,以便笔记本电脑意识到它已被重新插上...
quit()
lobianco@lobianco-officeLinux:~/Dropbox/Documenti/Varie/lef/papers/ffsm++/versions/07_carbon_balance_with_multipliers$ julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.5.1 (2017-03-05 13:25 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-pc-linux-gnu
julia> function f(n)
s = 0
for i = 1:n
s += i/2
end
s
end
f (generic function with 1 method)
julia> @time f(100000000) # after switched off internet and moved back to french
1.939228 seconds (300.00 M allocations: 4.470 GB, 13.96% gc time)
2.500000025e15
julia> @time f(100000000) # after switched off internet and moved back to french
1.761612 seconds (300.00 M allocations: 4.470 GB, 6.42% gc time)
2.500000025e15
julia> @time f(100000000) # after unplugged power but still laptop on his own deck
1.775432 seconds (300.00 M allocations: 4.470 GB, 6.30% gc time)
2.500000025e15
julia> @time f(100000000) # after removing laptop from the deck (still unplugged)
1.770068 seconds (300.00 M allocations: 4.470 GB, 6.28% gc time)
2.500000025e15
julia> @time f(100000000) # after removing laptop from the deck (still unplugged)
1.744716 seconds (300.00 M allocations: 4.470 GB, 6.32% gc time)
2.500000025e15
julia> @time f(100000000) # after suspend/resume
11.743261 seconds (300.00 M allocations: 4.470 GB, 5.28% gc time)
2.500000025e15
julia> @time f(100000000) # after plugging the power (still disconnected from deck)
11.722175 seconds (300.00 M allocations: 4.470 GB, 5.30% gc time)
2.500000025e15
julia> @time f(100000000) # after suspend/resume
1.770605 seconds (300.00 M allocations: 4.470 GB, 6.29% gc time)
2.500000025e15
julia>
答案1
我最后要说的是,这与拔掉电源插座有关。笔记本电脑会切换到低能耗模式,但只有在挂起/恢复时才会意识到任何变化。
因此,如果笔记本电脑放在自己的扩展坞上,插头连接到扩展坞,屏幕盖关闭(因为我使用外接屏幕/键盘),然后我取出笔记本电脑,将其打开,并将电缆从扩展坞切换到笔记本电脑(这是我的默认行为),笔记本电脑将继续以低能耗模式运行,因为它没有电源插头。然后我需要暂停/恢复笔记本电脑,以使其意识到它已重新连接(或者,在将笔记本电脑从扩展坞中取出之前,将插头从扩展坞移到笔记本电脑)。
在所有情况下,我都认为这是一个 ubuntu 错误,因为笔记本电脑应该实时意识到它是否连接到插座,而不仅仅是在暂停/恢复时。