vi_tools
Just a release to attach files
命令列訪問F_SETLEASE
$ touch q
$ ./lease q rw -- sh -c 'echo Cleanup request && sleep 1 && echo Now clean'&
[1] 28330
$ echo "Before trying to access" && cat q && echo "After tying to access"
Before trying to access
Cleanup request
Now clean
[1]+ Done ./lease q rw -- sh -c 'echo Cleanup request && sleep 1 && echo Now clean'
After tying to access
與flock
工具一樣,也可以對檔案描述符進行操作。
命令列存取控制群組記憶體壓力監控事件
Usage: cgroup_memory_pressure_monitor {low|medium|critical} /sys/fs/cgroup/memory/your_cgroup
使用 Ultra Kernel 同頁合併可壓縮的非零內容填入記憶體。
適用於 Linux 的 Rundll。從庫中載入類似 main 的符號並執行它。
$ ./runso ./runso main ./runso main
Usage: runso ./libsomelibrary.so main <args>
設定 oom_score_adj,然後用零填滿記憶體。
$ ./mempig
Killed
$ dmesg | grep -i oom
[228859.359178] mempig invoked oom-killer: gfp_mask=0x24280ca(GFP_HIGHUSER_MOVABLE|__GFP_ZERO), nodemask=0, order=0, oom_score_adj=1000
[228859.359234] [<ffffffff81168397>] oom_kill_process+0x237/0x450
[228859.359372] [ pid ] uid tgid total_vm rss nr_ptes nr_pmds swapents oom_score_adj name
[228860.221001] oom_reaper: reaped process 27664 (mempig), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
列出 UDP 連接埠並做兩件事:
也嘗試提高其調度優先權並將所有頁面鎖定到記憶體。
旨在以簡單的方式遠端控制各種 /sys/class/{brightness,gpio,pwm}/ 旋鈕。
監聽兩個 UDP 連接埠並在它們之間交換資訊。每個回覆都會寄到最後收到的對等地址。像這樣的東西:
socat udp-l:1234 udp-l:1235
但它不會「鎖定」某一對等點。
透過偵測不同的延遲並測試 connectin 是否仍然有效來測量 NAT 中的 UDP 連線逾時。伺服器部分根據傳入 UDP 封包的逾時來回覆 UDP 封包。客戶端檢查不斷增加的逾時,直到偵測到遺失的回覆資料包,然後「平分」以找出更準確的關閉延遲。範圍為 2 到 512 秒。 vi-server.org:909 連接埠上可能正在執行公共伺服器。
$ udptimeoutchecker probe 0.0.0.0 0 vi-server.org 909
Trying with timeout 1 seconds...OK
Trying with timeout 2 seconds...OK
Trying with timeout 4 seconds...OK
Trying with timeout 8 seconds...OK
Trying with timeout 16 seconds...OK
Trying with timeout 32 seconds...OK
Trying with timeout 64 seconds...OK
Trying with timeout 128 seconds...FAIL
Trying with timeout 128 seconds...FAIL
Trying with timeout 128 seconds...FAIL
Trying with timeout 96 seconds...FAIL
Trying with timeout 80 seconds...FAIL
Trying with timeout 72 seconds...FAIL
Trying with timeout 68 seconds...FAIL
Trying with timeout 66 seconds...FAIL
Intermediate result: 64
Trying with timeout 1 seconds...OK
Trying with timeout 2 seconds...OK
Trying with timeout 4 seconds...OK
Trying with timeout 8 seconds...OK
Trying with timeout 16 seconds...OK
Trying with timeout 32 seconds...OK
Trying with timeout 64 seconds...OK
Trying with timeout 128 seconds...FAIL
Trying with timeout 128 seconds...FAIL
Trying with timeout 128 seconds...FAIL
Trying with timeout 96 seconds...FAIL
Trying with timeout 80 seconds...FAIL
Trying with timeout 72 seconds...FAIL
Trying with timeout 68 seconds...FAIL
Trying with timeout 66 seconds...FAIL
Intermediate result: 64
Trying with timeout 1 seconds...OK
Trying with timeout 2 seconds...OK
Trying with timeout 4 seconds...OK
Trying with timeout 8 seconds...OK
Trying with timeout 16 seconds...OK
Trying with timeout 32 seconds...OK
Trying with timeout 64 seconds...OK
Trying with timeout 128 seconds...FAIL
Trying with timeout 128 seconds...FAIL
Trying with timeout 128 seconds...FAIL
Trying with timeout 96 seconds...FAIL
Trying with timeout 80 seconds...FAIL
Trying with timeout 72 seconds...FAIL
Trying with timeout 68 seconds...FAIL
Trying with timeout 66 seconds...FAIL
Intermediate result: 64
64
在每個 UDP 封包前面新增 12 個位元組的奈秒時間戳記(8 個位元組表示秒,4 個位元組表示奈秒)和 4 個位元組的每個客戶端序號,並將其傳回。
$ ./udp_ts_seq_reply 0.0.0.0 1919&
$ socat -x -v - udp:127.0.0.1:1919 > /dev/null
123
> 2018/02/19 19:52:08.981246 length=4 from=0 to=3
31 32 33 0a 123.
--
< 2018/02/19 19:52:08.981712 length=20 from=0 to=19
00 00 00 00 00 57 2f 47 09 a8 bf 83 00 00 00 01 .....W/G........
31 32 33 0a 123.
--
ABC
> 2018/02/19 19:52:11.439685 length=4 from=4 to=7
41 42 43 0a ABC.
--
< 2018/02/19 19:52:11.440078 length=20 from=20 to=39
00 00 00 00 00 57 2f 49 24 fa c5 ed 00 00 00 02 .....W/I$.......
41 42 43 0a ABC.
--
DEF
> 2018/02/19 19:52:13.094035 length=4 from=8 to=11
44 45 46 0a DEF.
--
< 2018/02/19 19:52:13.094455 length=20 from=40 to=59
00 00 00 00 00 57 2f 4b 10 61 48 68 00 00 00 03 .....W/K.aHh....
44 45 46 0a DEF.
--
$ dump_tc_stats
Usage: dump_tc_stats <iface>
Dump interface statistics periodically. Don't forget to `tc qdisc add <iface> root ...` something
$ dump_tc_stats veth0
{"PACKETS":23514,"BYTES":2979825,"RATE_BPS":0,"RATE_PPS":0,"QLEN":0,"BACKLOG":0,"DROPS":0,"REQUEUES":0,"OVERLIMITS":0}
{"PACKETS":23526,"BYTES":2981342,"RATE_BPS":0,"RATE_PPS":0,"QLEN":0,"BACKLOG":0,"DROPS":0,"REQUEUES":0,"OVERLIMITS":0}
...