Algorithm-TimelinePacking
view release on metacpan or search on metacpan
examples/basic_usage.pl view on Meta::CPAN
#!/usr/bin/env perl
#
# Basic usage example of the Algorithm::TimelinePacking module
#
use strict;
use warnings;
use FindBin qw($RealBin);
use lib "$RealBin/../lib";
use Algorithm::TimelinePacking;
use Data::Dumper;
# Create timeline with minimum spacing of 5 units between jobs
my $timeline = Algorithm::TimelinePacking->new(space => 5);
# Sample job data: [start, end, jobid, user, maps, reduces]
my @slices = (
[1000, 1200, 'job_001', 'alice', 100, 10],
[1100, 1300, 'job_002', 'bob', 200, 20], # overlaps with job_001
[1150, 1400, 'job_003', 'carol', 150, 15], # overlaps with both
[1500, 1600, 'job_004', 'alice', 300, 30], # no overlap
( run in 1.436 second using v1.01-cache-2.11-cpan-39bf76dae61 )