From c004fe10864c19bfd590403d22fbdf5ed993afd2 Mon Sep 17 00:00:00 2001 From: Gabe Venberg Date: Wed, 6 Mar 2024 18:28:07 -0600 Subject: [PATCH] added a code example to nushell post. --- content/posts/nushell.adoc | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/content/posts/nushell.adoc b/content/posts/nushell.adoc index db25ea8..471ae74 100644 --- a/content/posts/nushell.adoc +++ b/content/posts/nushell.adoc @@ -50,6 +50,36 @@ thoughts, and some criticisms along the way. == Parsing non-nu tools // show parsing initcall_debug logs, and how it then lets one do analysis on it +``` +[ 0.518096] calling prandom_reseed+0x0/0x40 @ 1 +[ 0.518119] initcall prandom_reseed+0x0/0x40 returned 0 after 12 usecs +[ 0.518127] calling clk_debug_init+0x0/0x140 @ 1 +[ 0.531128] initcall clk_debug_init+0x0/0x140 returned 0 after 12659 usecs +[ 0.531145] calling imx_amp_power_init+0x0/0x13c @ 1 +[ 0.531156] initcall imx_amp_power_init+0x0/0x13c returned 0 after 1 usecs +[ 0.531175] calling deferred_probe_initcall+0x0/0x3c @ 1 +[ 0.532275] imx_thermal 2000000.aips-bus:tempmon: Automotive CPU temperature grade - max:125C critical:120C passive:115C +[ 0.533166] pcm1753 pcm1753: Setting maximum volume limit of 226 +[ 0.535167] asoc-simple-card sound: PCM1753-HiFi <-> 2024000.esai mapping ok +[ 0.536199] initcall deferred_probe_initcall+0x0/0x3c returned 0 after 4880 usecs +[ 0.536217] calling pm_genpd_debug_init+0x0/0x70 @ 1 +[ 0.536249] initcall pm_genpd_debug_init+0x0/0x70 returned 0 after 20 usecs +[ 0.536262] calling genpd_poweroff_unused+0x0/0x8c @ 1 +[ 0.536284] initcall genpd_poweroff_unused+0x0/0x8c returned 0 after 11 usecs +[ 0.536296] calling gpio_keys_init+0x0/0x20 @ 1 +``` + +{{}} +open $file | +lines | +find '] initcall ' | +parse -r '\[\s*(?\d+\.\d+)\] (?.+) returned (?\d+) after (?.+)' | +update timestamp {into float} | +update delta {str replace ' usecs' 'us'} | +update delta {into duration} | +update return {into int} | +move delta --after timestamp +{{}} == Defining custom commands