// To target systems running 4.4.0-1-amd64, compile as follows: // stap -v -r 4.4.0-1-amd64 -m h2_spdy_stats h2-spdy-stats.stp -p 4 // // These packages need to be installed on the production system: // systemtap-runtime libssl1.0.0-dbg // // Run with: // staprun -v h2_spdy_stats.ko global bin // ALPN probe process("/usr/lib/x86_64-linux-gnu/libssl.so.1.0.0").function("SSL_select_next_proto") { value = text_str(user_string($client)) if (value =~ "h2") { if (value =~ "spdy") { bin["both"]++ } else { bin["h2"]++ } } } // NPN probe process("/usr/lib/x86_64-linux-gnu/libssl.so.1.0.0").function("SSL_get0_next_proto_negotiated") { if ($s->s3->next_proto_neg_seen && $s->next_proto_negotiated_len > 0) { value = text_str(user_string_n($s->next_proto_negotiated, $s->next_proto_negotiated_len)) if (value =~ "http/1.1") { bin["npn_http1"]++ } if (value =~ "spdy") { bin["spdy"]++ } } } probe process("/usr/lib/x86_64-linux-gnu/libssl.so.1.0.0").function("SSL_accept") { bin["total"]++ } probe end { foreach (key in bin) { printf("%s: %d \n", key, bin[key]) } }