blob: a575afdc509266e52588e1fd875ede70ea98754c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
---
title: Pause all userspace processes
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?
|