mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.3 KiB

  1. #!/usr/bin/perl
  2. #
  3. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  4. #
  5. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  6. # Please add additional copyright information _after_ the line containing
  7. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  8. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  9. #
  10. # ROCK Linux: rock-src/scripts/parasim1.pl
  11. # ROCK Linux is Copyright (C) 1998 - 2004 Clifford Wolf
  12. #
  13. # This program is free software; you can redistribute it and/or modify
  14. # it under the terms of the GNU General Public License as published by
  15. # the Free Software Foundation; either version 2 of the License, or
  16. # (at your option) any later version. A copy of the GNU General Public
  17. # License can be found at Documentation/COPYING.
  18. #
  19. # Many people helped and are helping developing ROCK Linux. Please
  20. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  21. # file for details.
  22. #
  23. # --- ROCK-COPYRIGHT-NOTE-END ---
  24. my $size_x=70;
  25. my $size_y=17;
  26. my @data_val;
  27. my @data_nr;
  28. my $max_x = 0;
  29. my $max_y = 0;
  30. my ($x, $y);
  31. open(F, $ARGV[0]) || die $!;
  32. while (<F>) {
  33. @_ = split /\s+/;
  34. $max_x++;
  35. $max_y=$_[1] if $_[1] > $max_y;
  36. }
  37. close F;
  38. open(F, $ARGV[0]) || die $!;
  39. for ($x=0; <F>; $x++) {
  40. @_ = split /\s+/;
  41. $_ = int(($x*$size_x) / $max_x);
  42. $data_val[$_] = 0 unless defined $data_val[$_];
  43. $data_nr[$_] = 0 unless defined $data_nr[$_];
  44. $data_val[$_] += $_[1];
  45. $data_nr[$_]++;
  46. }
  47. close(F);
  48. $max_y=$ARGV[1] if $ARGV[1] > 0;
  49. my @leftlabel=qw/. . P a r a l l e l . J o b s . ./;
  50. print "\n ----+----------------------------------------" .
  51. "------------------------------+\n";
  52. for ($y=$size_y; $y>0; $y--) {
  53. if ($y == $size_y) { printf(" %3d |", $max_y); }
  54. elsif ($y == 1) { print " 1 |"; }
  55. else {
  56. print " ", ($leftlabel[$size_y - $y] ne '.' ?
  57. $leftlabel[$size_y - $y] : ' '), " |";
  58. }
  59. for ($x=0; $x<$size_x; $x++) {
  60. $_ = ($data_val[$x]*$size_y*2 / $data_nr[$x]) / $max_y;
  61. if ($_ >= $y*2-1) { print ":"; }
  62. elsif ($_ >= $y*2-2) { print "."; }
  63. else { print " "; }
  64. }
  65. print "|\n";
  66. }
  67. print " ----+----------------------------------------" .
  68. "------------------------------+\n";
  69. printf(" | 1 Number of Jobs build so far " .
  70. " %5d |\n\n", $max_x);