aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/_posts/2022-09-07-gdb-sleep-all.md
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-09-07 16:01:12 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2022-09-07 16:01:12 +0200
commit346637cb93ae39223f91f318bf265a1b7ba87abb (patch)
tree54583e7941ff4cc1982868bc43e27b1ce5d4cdf1 /_posts/2022-09-07-gdb-sleep-all.md
parentREADME: update (diff)
downloadblog-346637cb93ae39223f91f318bf265a1b7ba87abb.tar.gz
blog-346637cb93ae39223f91f318bf265a1b7ba87abb.zip
add "Pause all userspace processes"
Diffstat (limited to '_posts/2022-09-07-gdb-sleep-all.md')
-rw-r--r--_posts/2022-09-07-gdb-sleep-all.md35
1 files changed, 35 insertions, 0 deletions
diff --git a/_posts/2022-09-07-gdb-sleep-all.md b/_posts/2022-09-07-gdb-sleep-all.md
new file mode 100644
index 0000000..b4915d3
--- /dev/null
+++ b/_posts/2022-09-07-gdb-sleep-all.md
@@ -0,0 +1,35 @@
+---
+title: Pause all userspace processes
+excerpt: >
+ How do you pause all userspace processes for a certain amount of time?
+snippets_root_directory: snippets/gdb_sleep_all
+snippets_language: bash
+snippets:
+ main:
+ - gdb_sleep_all.sh
+ gdb:
+ - sleep.gdb
+---
+If you need to debug some kind of monitoring system (or just have some fun),
+you might want to pause all userspace processes for a certain number of seconds
+(to measure delays, etc.).
+
+You can easily do this using GDB like this:
+
+{% include jekyll-theme/snippets/section.html section_id='main' %}
+
+sleep.gdb is a very simple GDB script; it basically sleeps for a determined
+amount of seconds:
+
+{% include jekyll-theme/snippets/section.html section_id='gdb' %}
+
+You can simply run
+
+ sudo ./gdb_sleep_all.sh
+
+and all of your userspace processes should be frozen for 30 seconds.
+
+On a couple of servers, this worked quite well; not so well on my laptop with
+Xfce installed.
+Obviously, this would require a bit of work to adapt for containers as well.
+Otherwise, pretty neat, huh?