Using perf:
$ perf record -g binary
$ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg
NOTE: See @GabrielMajeri's comments below about the
-goption.
| /* | |
| * This sample illustrates how to go back to deep sleep from the | |
| * deep sleep wake stub. | |
| * | |
| * Consider the use case of counting pulses from an external sensor, | |
| * where the pulses arrive at a relatively slow rate. | |
| * | |
| * ESP32 is configured to go into deep sleep mode, and wake up from | |
| * a GPIO pin connected to the external pulse source. | |
| * Once the pulse arrives, ESP32 wakes up from deep sleep and runs |
Using perf:
$ perf record -g binary
$ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg
NOTE: See @GabrielMajeri's comments below about the
-goption.
Streaming your Linux desktop to Youtube and Twitch via Nvidia's NVENC and VAAPI:
Considerations to take when live streaming:
The following best practice observations apply when using a hardware-based encoder for live streaming to any platform:
Set the buffer size (-bufsize:v) equal to the target bitrate (-b:v). You want to ensure that you're encoding in CBR mode.
Set up the encoders as shown:
At the time of this writing, Rust and Cargo are available on FreeBSD/amd64 and FreeBSD/i386 only, whether it is from rustup or from the FreeBSD ports tree. Here is how I could bootstrap Rust and Cargo for FreeBSD/aarch64 from FreeBSD/amd64.
To be able to cross-compile anything, you need a userland for the target.
| A list of languages which compile to JS (Elm, Purescript, OCaml) | |
| (Inspired by this thread: https://groups.google.com/forum/#!topic/elm-discuss/Um7WIBTq9xU) | |
| They all support curry calling convention by default. | |
| Some interesting results: | |
| 1. `min` is curried function, only OCaml(BuckleScript) managed to optimize this overhead. | |
| 2. All optimize the self tail call | |
| 3. Only BuckleScript and PureScript type-specialized comparison functoin (>=) and inlined |
| Copy all the files to the build directory. | |
| Copy icudtl.dat to the build directory. (you can find it in the vscode downloads ex for linux). | |
| chromium version in port is 52.0.2743.116. | |
| This was built with FreeBSD 11.0-RELEASE-p1. If building with other versions probably need to change | |
| the freebsd versions in diff files (ex. freebsd11 => freebsd10) | |
| Installed | |
| node => v6.9.1 | |
| npm => 3.9.2 | |
| >chmod 755 vscode_build.sh |
| #!/usr/bin/sed -rf | |
| # Unmangle Rust symbols | |
| # See https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/?id=cae15db74999edb96dd9f5bbd4d55849391dd92b | |
| # Example, with [FlameGraph](https://github.com/brendangregg/FlameGraph): | |
| # perf record -g target/debug/bin | |
| # perf script | stackcollapse-perf | rust-unmangle | flamegraph > perf.svg | |
| # Remove hash and address offset | |
| s/::h[0-9a-f]{16}//g | |
| s/\+0x[0-9a-f]+//g |
It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.
| #!/bin/sh | |
| # | |
| # Copyright (c) 2016 Babak Farrokhi. All rights reserved. | |
| # | |
| # Redistribution and use in source and binary forms, with or without | |
| # modification, are permitted provided that the following conditions | |
| # are met: | |
| # | |
| # 1. Redistributions of source code must retain the above copyright |
| #![allow(non_camel_case_types)] | |
| use std::mem; | |
| // The Situation | |
| struct ffi_Object; | |
| type ffi_Callback = unsafe extern fn(*mut ffi_Object) -> u32; | |
| extern fn ffi_push_callback(_: *mut ffi_Object, _: ffi_Callback) {} | |
| // Dummy wrapper | |
| struct Object { |