Skip to content

Instantly share code, notes, and snippets.

#[cfg(test)]
mod tests {
use std::process::Command;
use std::time::Duration;
use std::{env, thread};
#[test]
fn child_process_hack() {
let in_child = env::args().any(|x| x == "child_process_hack");
if !in_child {
@danhhz
danhhz / instruments_criterion.rs
Created April 29, 2021 15:04
Criterion Profiler impl to surround benchmarks with Points of Interest in Instruments
struct InstrumentsPointsOfInterest;
impl InstrumentsPointsOfInterest {
fn code(x: &std::path::Path) -> u32 {
// NB: kdebug_signpost* only keeps the bottom 14 bits of this but that
// seems fine.
use std::collections::hash_map::DefaultHasher;
let mut h = DefaultHasher::new();
x.hash(&mut h);
h.finish() as u32

Keybase proof

I hereby claim:

  • I am danhhz on github.
  • I am danhhz (https://keybase.io/danhhz) on keybase.
  • I have a public key ASDoRChLsrFTQbIuRanvdU9qMFFJilErfZBQJaCjhrV4nwo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am danhhz on github.
  • I am dharrison (https://keybase.io/dharrison) on keybase.
  • I have a public key whose fingerprint is EB39 3E5D D8E8 1C1E 108A 8A95 945E 0BE1 82C2 4CE2

To claim this, I am signing this object: