作者归档:raymond

关闭英特尔显示器节能技术(Intel DPST)避免笔记本使用电池时打开深色页面屏幕变暗

在笔记本拔掉电源只使用电池的时候常会遇到屏幕上是深色页面的时候显示器渐渐变暗的情况,令人烦不胜烦。一开始以为是微软的锅,结果一番查询之后发现是由于英特尔的显示器节能技术(Intel Display Power Saving Technology, Intel DPST)技术捣的鬼。
解决办法也很简单:
用Win+R快捷键呼出运行,输入regedit之后确定打开注册表编辑器。定位到:
“计算机\HKEY_LOCALMACHINE\SYSTEM\ControlSet001\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}\0001”(也可能在0000、0002项目下,重点是下面标粗的项目名字)
里的名称为“FeatureTestControl”的REGDWORD项目。如果是8200则修改为8210,如果是9240就修改为9250,(注意是十六进制的数值。)以此类推。
之后,重启电脑即可。
如果十六进制是F800那么就改成F810

https://zhuanlan.zhihu.com/p/383082737

PR里面如何将插入的图片设置为全屏

图片的分辨率是有要求的,取决于拍摄设备的分辨率,几乎所有的拍摄设备,视频大小一般都是1080p的整数倍。所以需要将图片剪切为1080分辨率的整数倍,图片才能在pr里面全屏,否则由于分辨率不通肯定是填不满屏幕的。
1080P的分辨率为1920×1080,在ps里面选择剪切工具,然后设置宽度1920,高度1080回车,即可剪切这个比例的图片了。
然后将剪切出来的图片导入到pr里面,在图片轨道上面点击右键,选择缩放为帧大小即可。

git下载指定版本的代码并制作patch以及如何打patch

首先使用git clone把代码更新到本地。

使用git log –grep=word 搜索指定的版本。
gcc@gcc-x64:/mnt/AX3600$ git log –grep AX3600
commit 9d8a34c9abb6c13f9bebc28d9c4c10fe512491d4 (HEAD -> newBranch)
Author: lean <coolsnowwolf@gmail.com>
Date: Mon Jun 14 20:08:28 2021 +0800
ipq807x: add Xiaomi AX3600 and ath11k support

生成指定版本的patch:
git format-patch -1 9d8a34c9abb6c13f9bebc28d9c4c10fe512491d4

应用patch:
先检查patch文件:git apply –stat newpatch.patch
检查能否应用成功:git apply –check newpatch.patch
打补丁:git am –signoff < newpatch.patch
(使用-s或–signoff选项,可以commit信息中加入Signed-off-by信息)
如果需要撤回刚才打上的那个Patch,使用命令:git apply -R ***.patch

参考:
https://blog.csdn.net/M_Eve/article/details/84327219
https://www.zhangshengrong.com/p/QrXebElo1d/
https://blog.csdn.net/robertsong2004/article/details/46893169

20220805 updated

使用git apply –reject file.patch 这个命令会自动合入不冲突的代码,然后保留冲突的部分,同时在冲突的文件夹下面会生成后缀为.rej的文件,用于保存没有合并进去的部分,可以参考这个进行冲突解决。
解决完冲突后,删除后缀为.rej文件,并执行git add . 添加改动到暂存区,然后git commit -m “注释语句” 增加commit。
最后git log 查看刚才的commit,然后生成指定版本的patch:
git format-patch -1 9d8a34c9abb6c13f9bebc28d9c4c10fe512491d4

参考网址:
https://www.its203.com/article/salmon_zhang/97015801

I5-8250U在hyper-v下面使用unixbench测试性能

BYTE UNIX Benchmarks (Version 5.1.3)

System: gcc-x64: GNU/Linux
OS: GNU/Linux — 5.4.0-122-generic — #138-Ubuntu SMP Wed Jun 22 15:00:31 UTC 2022
Machine: x86_64 (x86_64)
Language: en_US.utf8 (charmap=”UTF-8″, collate=”UTF-8″)
CPU 0: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz (3600.0 bogomips)
Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
CPU 1: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz (3600.0 bogomips)
Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
CPU 2: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz (3600.0 bogomips)
Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
CPU 3: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz (3600.0 bogomips)
Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
CPU 4: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz (3600.0 bogomips)
Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
CPU 5: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz (3600.0 bogomips)
Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
CPU 6: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz (3600.0 bogomips)
Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
CPU 7: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz (3600.0 bogomips)
Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
06:46:06 up 7:49, 2 users, load average: 0.00, 0.00, 0.00; runlevel 5

————————————————————————
Benchmark Run: Sat Jul 23 2022 06:46:06 – 07:14:12
8 CPUs in system; running 1 parallel copy of tests

Dhrystone 2 using register variables 42608524.8 lps (10.0 s, 7 samples)
Double-Precision Whetstone 6489.4 MWIPS (9.9 s, 7 samples)
Execl Throughput 4129.9 lps (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 635787.5 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 169590.5 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 1985937.5 KBps (30.0 s, 2 samples)
Pipe Throughput 865156.9 lps (10.0 s, 7 samples)
Pipe-based Context Switching 20744.7 lps (10.0 s, 7 samples)
Process Creation 7347.1 lps (30.0 s, 2 samples)
Shell Scripts (1 concurrent) 10401.9 lpm (60.0 s, 2 samples)
Shell Scripts (8 concurrent) 2980.9 lpm (60.0 s, 2 samples)
System Call Overhead 537140.1 lps (10.0 s, 7 samples)

System Benchmarks Index Values BASELINE RESULT INDEX
Dhrystone 2 using register variables 116700.0 42608524.8 3651.1
Double-Precision Whetstone 55.0 6489.4 1179.9
Execl Throughput 43.0 4129.9 960.5
File Copy 1024 bufsize 2000 maxblocks 3960.0 635787.5 1605.5
File Copy 256 bufsize 500 maxblocks 1655.0 169590.5 1024.7
File Copy 4096 bufsize 8000 maxblocks 5800.0 1985937.5 3424.0
Pipe Throughput 12440.0 865156.9 695.5
Pipe-based Context Switching 4000.0 20744.7 51.9
Process Creation 126.0 7347.1 583.1
Shell Scripts (1 concurrent) 42.4 10401.9 2453.3
Shell Scripts (8 concurrent) 6.0 2980.9 4968.2
System Call Overhead 15000.0 537140.1 358.1
========
System Benchmarks Index Score 1065.4

————————————————————————
Benchmark Run: Sat Jul 23 2022 07:14:12 – 07:42:44
8 CPUs in system; running 8 parallel copies of tests

Dhrystone 2 using register variables 153654544.7 lps (10.0 s, 7 samples)
Double-Precision Whetstone 34421.6 MWIPS (11.5 s, 7 samples)
Execl Throughput 13329.0 lps (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 712096.5 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 180312.6 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 2250174.5 KBps (30.0 s, 2 samples)
Pipe Throughput 3111422.7 lps (10.0 s, 7 samples)
Pipe-based Context Switching 601761.1 lps (10.0 s, 7 samples)
Process Creation 22973.2 lps (30.0 s, 2 samples)
Shell Scripts (1 concurrent) 23595.3 lpm (60.0 s, 2 samples)
Shell Scripts (8 concurrent) 3313.3 lpm (60.0 s, 2 samples)
System Call Overhead 1990193.6 lps (10.0 s, 7 samples)

System Benchmarks Index Values BASELINE RESULT INDEX
Dhrystone 2 using register variables 116700.0 153654544.7 13166.6
Double-Precision Whetstone 55.0 34421.6 6258.5
Execl Throughput 43.0 13329.0 3099.8
File Copy 1024 bufsize 2000 maxblocks 3960.0 712096.5 1798.2
File Copy 256 bufsize 500 maxblocks 1655.0 180312.6 1089.5
File Copy 4096 bufsize 8000 maxblocks 5800.0 2250174.5 3879.6
Pipe Throughput 12440.0 3111422.7 2501.1
Pipe-based Context Switching 4000.0 601761.1 1504.4
Process Creation 126.0 22973.2 1823.3
Shell Scripts (1 concurrent) 42.4 23595.3 5564.9
Shell Scripts (8 concurrent) 6.0 3313.3 5522.1
System Call Overhead 15000.0 1990193.6 1326.8
========
System Benchmarks Index Score 3005.4
测试的时候,由于笔记本散热原因,CPU基本上长时间在2.1Ghz运行。
下面贴一个J1900CPU,宿主机运行openwrt,在docker里运行ubuntu使用unixbench测试的得分。
BYTE UNIX Benchmarks (Version 5.1.3)

System: OpenWrt: GNU/Linux
OS: GNU/Linux — 5.15.35 — #0 SMP Mon Apr 25 11:18:22 2022
Machine: x86_64 (x86_64)
Language: en_US.utf8 (charmap=”ANSI_X3.4-1968″, collate=”ANSI_X3.4-1968″)
CPU 0: Intel(R) Celeron(R) CPU J1900 @ 1.99GHz (4000.0 bogomips)
Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
CPU 1: Intel(R) Celeron(R) CPU J1900 @ 1.99GHz (4000.0 bogomips)
Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
CPU 2: Intel(R) Celeron(R) CPU J1900 @ 1.99GHz (4000.0 bogomips)
Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
CPU 3: Intel(R) Celeron(R) CPU J1900 @ 1.99GHz (4000.0 bogomips)
Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
15:47:42 up 7 days, 12:59, 0 users, load average: 0.74, 0.33, 0.14; runlevel

————————————————————————
Benchmark Run: Fri Jul 22 2022 15:47:42 – 16:15:46
4 CPUs in system; running 1 parallel copy of tests

Dhrystone 2 using register variables 11870208.3 lps (10.0 s, 7 samples)
Double-Precision Whetstone 2427.7 MWIPS (10.2 s, 7 samples)
Execl Throughput 1596.9 lps (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 242133.1 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 66194.7 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 637394.7 KBps (30.0 s, 2 samples)
Pipe Throughput 466222.1 lps (10.0 s, 7 samples)
Pipe-based Context Switching 41094.0 lps (10.0 s, 7 samples)
Process Creation 2470.1 lps (30.0 s, 2 samples)
Shell Scripts (1 concurrent) 3385.2 lpm (60.0 s, 2 samples)
Shell Scripts (8 concurrent) 1181.3 lpm (60.0 s, 2 samples)
System Call Overhead 376589.3 lps (10.0 s, 7 samples)

System Benchmarks Index Values BASELINE RESULT INDEX
Dhrystone 2 using register variables 116700.0 11870208.3 1017.2
Double-Precision Whetstone 55.0 2427.7 441.4
Execl Throughput 43.0 1596.9 371.4
File Copy 1024 bufsize 2000 maxblocks 3960.0 242133.1 611.4
File Copy 256 bufsize 500 maxblocks 1655.0 66194.7 400.0
File Copy 4096 bufsize 8000 maxblocks 5800.0 637394.7 1099.0
Pipe Throughput 12440.0 466222.1 374.8
Pipe-based Context Switching 4000.0 41094.0 102.7
Process Creation 126.0 2470.1 196.0
Shell Scripts (1 concurrent) 42.4 3385.2 798.4
Shell Scripts (8 concurrent) 6.0 1181.3 1968.8
System Call Overhead 15000.0 376589.3 251.1
========
System Benchmarks Index Score 475.5

————————————————————————
Benchmark Run: Fri Jul 22 2022 16:15:46 – 16:43:51
4 CPUs in system; running 4 parallel copies of tests

Dhrystone 2 using register variables 46351886.4 lps (10.0 s, 7 samples)
Double-Precision Whetstone 9709.4 MWIPS (10.2 s, 7 samples)
Execl Throughput 4547.2 lps (29.8 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks 422497.9 KBps (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks 123753.2 KBps (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks 1023713.4 KBps (30.0 s, 2 samples)
Pipe Throughput 1829630.5 lps (10.0 s, 7 samples)
Pipe-based Context Switching 269682.6 lps (10.0 s, 7 samples)
Process Creation 9473.4 lps (30.0 s, 2 samples)
Shell Scripts (1 concurrent) 10449.0 lpm (60.0 s, 2 samples)
Shell Scripts (8 concurrent) 1413.0 lpm (60.1 s, 2 samples)
System Call Overhead 1377797.4 lps (10.0 s, 7 samples)

System Benchmarks Index Values BASELINE RESULT INDEX
Dhrystone 2 using register variables 116700.0 46351886.4 3971.9
Double-Precision Whetstone 55.0 9709.4 1765.3
Execl Throughput 43.0 4547.2 1057.5
File Copy 1024 bufsize 2000 maxblocks 3960.0 422497.9 1066.9
File Copy 256 bufsize 500 maxblocks 1655.0 123753.2 747.8
File Copy 4096 bufsize 8000 maxblocks 5800.0 1023713.4 1765.0
Pipe Throughput 12440.0 1829630.5 1470.8
Pipe-based Context Switching 4000.0 269682.6 674.2
Process Creation 126.0 9473.4 751.9
Shell Scripts (1 concurrent) 42.4 10449.0 2464.4
Shell Scripts (8 concurrent) 6.0 1413.0 2355.0
System Call Overhead 15000.0 1377797.4 918.5
========
System Benchmarks Index Score 1364.1

可以看出,J1900的CPU还是很强悍的。I5-8250U理论上相当于5倍的J1900性能,但是由于在hyper-v虚拟机下面测试,性能折损较大。
关于不同CPU性能测试,可以参考这篇文章。
http://www.wifizoo.net/archives/2017

openwrt运行青龙面板不联网的解决办法

openwrt下创建基于bridge模式的容器,默认是无法访问公网的,只能lan访问。
解决办法就是创建host网络而非bridge。
host模式下容器是直接联网的,无需端口映射,也无需debug。
直接在ssh下运行
docker run -dit \
-v $pwd/ql/config:/ql/config \
-v $pwd/ql/log:/ql/log \
-v $pwd/ql/db:/ql/db \
-v $pwd/ql/scripts:/ql/scripts \
-v $pwd/ql/jbot:/ql/jbot \
-e ENABLE_HANGUP=true \
-e ENABLE_WEB_PANEL=true \
–name qinglong \
–hostname qinglong \
–restart always \
–net host \
whyour/qinglong:latest

使用bridge模式:
直接在ssh下运行
docker run -dit \
-v $pwd/ql/config:/ql/config \
-v $pwd/ql/log:/ql/log \
-v $pwd/ql/db:/ql/db \
-v $pwd/ql/scripts:/ql/scripts \
-v $pwd/ql/jbot:/ql/jbot \
-p 5701:5700 \
-e ENABLE_HANGUP=true \
-e ENABLE_WEB_PANEL=true \
–name qinglong1 \
–hostname qinglong1 \
–restart always \
whyour/qinglong:latest

openwrt下面使用Docker容器默认bridge模式无法访问外部网络的解决办法
http://www.wifizoo.net/archives/2291