Skip to content

Instantly share code, notes, and snippets.

@esproul
esproul / mmap_test.c
Created January 27, 2017 18:57
illumos mmap latency test program
/* MMAP testing utility
*
* Build: gcc -o mmap_test mmap_test.c
*
* Create the test files:
* mkdir test_data
* for i in {1..1000} ; do \
* head -c 1000000 < /dev/urandom > test_data/test_data${i}.bin
* done
*
@esproul
esproul / gist:6d6303a9162659b006d22f72e55f2204
Created November 23, 2016 16:35
Odd ZFS directory stats
# /usr/gnu/bin/du -hs .
34M .
# /usr/gnu/bin/du -hs --apparent-size .
44K .
# WAT??
# ls -ldi .
44954 drwxr-x--- 2 root root 9 Sep 6 15:50 .
@esproul
esproul / watch-slabs.d
Last active October 7, 2016 21:08
Track ZFS metaslab loading and unloading
/* Usage: dtrace -s watch-slabs.d <pool-name> */
#pragma D option quiet
fbt::metaslab_load:entry
/args[0]->ms_group->mg_vd->vdev_spa->spa_name == $$1/
{
self->loading = 1;
self->slab_id = args[0]->ms_id;
self->tlvdev_type = stringof(args[0]->ms_group->mg_vd->vdev_ops->vdev_op_type);
@esproul
esproul / slabs_loaded.txt
Last active October 7, 2016 20:41
ZFS: given a spa_t, print metaslab IDs that are currently loaded in core
<spa_t>::walk metaslab | ::printf "tl-vdev_id: %d slab: %d loaded: %d\n" metaslab_t ms_group->mg_vd->vdev_id ms_id ms_loaded !grep "loaded: 1"
debug:
debug: Solaris Linkers: 5.11-1.1749 (illumos)
debug:
debug: arg[1] option=-D: option-argument: args
debug: arg[2] option=-R: option-argument: /opt/circonus/lib
debug: arg[4] option=-R: option-argument: /opt/local/lib/
debug: arg[5] option=-Y: option-argument: P,/lib/amd64:/usr/lib/amd64:/opt/local/lib/
debug: arg[7] option=-Q: option-argument: y
debug: arg[8] option=-o: option-argument: conftest
debug: arg[14] option=-L: option-argument: /opt/circonus/lib
$ elfdump -d /opt/local/lib/libxslt.so.1.1.28
Dynamic Section: .dynamic
index tag value
[0] NEEDED 0x2dc1 libxml2.so.2
[1] NEEDED 0x2dce liblzma.so.5
[2] NEEDED 0x2ddb libz.so.1
[3] NEEDED 0x2de5 libpthread.so.1
[4] NEEDED 0x2d7a librt.so.1
[5] NEEDED 0x2df5 libiconv.so.2
debug:
debug: Solaris Linkers: 5.11-1.1749 (illumos)
debug:
debug: search path=/lib/amd64:/usr/lib/amd64:/opt/local/lib/ (LIBPATH or -YP)
debug: Library Search Paths (initial)
debug: /lib/amd64
debug: /usr/lib/amd64
debug: /opt/local/lib/
debug:
debug: Library Search Paths (-L updated)
(gdb) bt
#0 BaseLogFile::roll (this=0x57f7550, interval_start=<optimized out>, interval_end=<optimized out>) at BaseLogFile.cc:119
#1 0x00000000006ebee0 in LogObjectManager::_solve_filename_conflicts (this=this@entry=0x36b9df8, log_object=log_object@entry=0xf17a90,
maxConflicts=maxConflicts@entry=99) at LogObject.cc:1029
#2 0x00000000006ec619 in LogObjectManager::_manage_object (this=0x36b9df8, log_object=0xf17a90, is_api_object=false, maxConflicts=99)
at LogObject.cc:894
#3 0x00000000006db8db in manage_object (maxConflicts=99, logObject=0xf17a90, this=0x36b9df8) at LogObject.h:394
#4 LogConfig::read_xml_log_config (this=this@entry=0x36b9dd0) at LogConfig.cc:1468
#5 0x00000000006dda70 in setup_log_objects (this=0x36b9dd0) at LogConfig.cc:503
#6 LogConfig::init (this=0x36b9dd0, prev_config=0x0) at LogConfig.cc:388
(gdb) break BaseLogFile::roll
Function "BaseLogFile::roll" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (BaseLogFile::roll) pending.
(gdb) run
Starting program: /opt/circonus/bin/traffic_server
warning: Cannot initialize thread debugging library: Debugger service failed
warning: Cannot initialize thread debugging library: Debugger service failed
warning: Cannot initialize thread debugging library: Debugger service failed
traffic_server: using root directory '/opt/circonus'
$ sudo dtrace -lvn 'fqd::client-connect'
ID PROVIDER MODULE FUNCTION NAME
65814 fq33268 fqd conn_handler client-connect
Probe Description Attributes
Identifier Names: Private
Data Semantics: Private
Dependency Class: Unknown
Argument Attributes