rrdreel

Check-in [a71b1b761b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:improve stdin pooling
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:a71b1b761bf636f201d154ca6d0d6870342bf2ab8b1bb62259b9733bb00f3e94
User & Date: jef@foutaise.org 2016-11-27 21:41:40
Context
2018-01-06
17:58
More verbose message on backend load error check-in: ff013f23cc user: jef@foutaise.org tags: trunk
2016-11-27
21:41
improve stdin pooling check-in: a71b1b761b user: jef@foutaise.org tags: trunk
20:09
Update README.md check-in: 510d3bff89 user: noreply@github.com tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to rrdreel.

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
..
36
37
38
39
40
41
42
43
44
45
46




47
48

49
50
51
52
53
54
55
56
57
use strict;
use warnings;
use 5.010;

use Tk;
use Tk::Menu;
use Tk::widgets qw(PNG);

use File::Basename qw(dirname);
use lib dirname($0);

our $cleanup;

sub graph {
        my ($backend) = @_;
................................................................................
                $lastimage->delete() if defined $lastimage;
                $lastimage = $image;
        };

        # callback for RRD update
        my $rrd_update;
        $rrd_update = sub {
                state $running = 0;

                return if $running;
                $running = 1;




                $backend->rrd_update();
                $img_update->();

                $mw->after($backend->step() * 1000, $rrd_update);
                $running = 0;
        };

        # popup menu to select timeslot view
        my $menu = $mw->Menu(-tearoff => 0);
        foreach my $ts (@{ $backend->timeslots() }) {
                $menu->add('command',
			-label => $ts->{label},







|







 







|

|
|
>
>
>
>
|
|
>
|
<







6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
..
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54

55
56
57
58
59
60
61
use strict;
use warnings;
use 5.010;

use Tk;
use Tk::Menu;
use Tk::widgets qw(PNG);
use IO::Select;
use File::Basename qw(dirname);
use lib dirname($0);

our $cleanup;

sub graph {
        my ($backend) = @_;
................................................................................
                $lastimage->delete() if defined $lastimage;
                $lastimage = $image;
        };

        # callback for RRD update
        my $rrd_update;
        $rrd_update = sub {
                state $select;

                if (not defined $select) {
                        $select = IO::Select->new();
                        $select->add(\*STDIN);
                }

                if ($select->can_read(.1)) {
                        $backend->rrd_update();
                        $img_update->();
                }
                $mw->after(100, $rrd_update);

        };

        # popup menu to select timeslot view
        my $menu = $mw->Menu(-tearoff => 0);
        foreach my $ts (@{ $backend->timeslots() }) {
                $menu->add('command',
			-label => $ts->{label},