Reads ITM/SWD instrumentation trace streams inside an AnyEvent event loop. It
is a thin layer on top of the ITM distribution, which decodes the wire
format: this one frames packets out of a byte stream and hands them to a
callback.
use AnyEvent;
use AnyEvent::ITM;
my $cv = AE::cv;
AnyEvent::ITM->handle( '/dev/ttyACM0', sub {
my ( $handle, $itm ) = @_;
print $itm->payload if ref($itm) eq 'ITM::Instrumentation';
}, $cv );
warn $cv->recv;Loading the module registers the itm read type with AnyEvent::Handle;
$handle->push_read( itm => $callback ) consumes exactly one packet per call
and never a partial one.
itm_read_simple- prints the instrumentation payloads of a file, pipe or device as timestamped linesitm_read_nocolor- the same reader
Both take the file as first argument and an optional command to run alongside, whose output is timestamped too.
The POD of AnyEvent::ITM and of both scripts is the reference:
perldoc AnyEvent::ITM.
cpanm --installdeps .
prove -lr t/
IRC: #hardware on irc.perl.org.
This software is copyright (c) 2015 by Torsten Raudssus. It is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.