Skip to content

Commit

Permalink
Make sure Telemetry - Telemetry returns a T::Period
Browse files Browse the repository at this point in the history
- also fix Telemetry::Period.perl invocant check
  • Loading branch information
lizmat committed Oct 28, 2017
1 parent 273168d commit 3e175c8
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/core/Telemetry.pm
Expand Up @@ -104,7 +104,7 @@ class Telemetry::Period is Telemetry {
$period
}

multi method perl(Telemetry::Period:) {
multi method perl(Telemetry::Period:D:) {
"Telemetry::Period.new(:cpu-user({
nqp::getattr_i(self,Telemetry,'$!cpu-user')
}), :cpu-sys({
Expand All @@ -116,7 +116,20 @@ class Telemetry::Period is Telemetry {
}

multi sub infix:<->(Telemetry $a, Telemetry $b) {
$a.cpu - $b.cpu
Telemetry::Period.new(
nqp::sub_i(
nqp::getattr_i(nqp::decont($a),Telemetry,'$!cpu-user'),
nqp::getattr_i(nqp::decont($b),Telemetry,'$!cpu-user')
),
nqp::sub_i(
nqp::getattr_i(nqp::decont($a),Telemetry,'$!cpu-sys'),
nqp::getattr_i(nqp::decont($b),Telemetry,'$!cpu-sys')
),
nqp::sub_i(
nqp::getattr_i(nqp::decont($a),Telemetry,'$!wallclock'),
nqp::getattr_i(nqp::decont($b),Telemetry,'$!wallclock')
)
)
}

# vim: ft=perl6 expandtab sw=4

0 comments on commit 3e175c8

Please sign in to comment.