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.

97 lines
2.5 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/parasim3.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, $max_x) = (68, 0);
  25. my $size_y=int( 16 / ($#ARGV+1) );
  26. my $file;
  27. foreach $file (@ARGV) {
  28. open(F, $file) || die $!;
  29. while (<F>) {
  30. @_ = split /\s+/;
  31. $_[0]=int($_[0] * 100);
  32. $max_x=$_[0] if $_[0] > $max_x;
  33. }
  34. close F;
  35. }
  36. print "\n -----+-----------------------------------" .
  37. "---------------------------------+\n";
  38. foreach $file (reverse @ARGV) {
  39. my @data_val;
  40. my @data_nr;
  41. my $max_y = 0;
  42. my ($x, $newx, $y);
  43. open(F, $file) || die $!;
  44. while (<F>) {
  45. @_ = split /\s+/;
  46. $max_y=$_[1] if $_[1] > $max_y;
  47. }
  48. close F;
  49. open(F, $file) || die $!;
  50. for ($x=0; <F>; ) {
  51. @_ = split /\s+/;
  52. for ($newx=int($_[0] * 100); $x <= $newx; $x++) {
  53. $_ = int(($x*$size_x) / $max_x);
  54. $data_val[$_] = 0 unless defined $data_val[$_];
  55. $data_nr[$_] = 0 unless defined $data_nr[$_];
  56. $data_val[$_] += $_[1];
  57. $data_nr[$_]++;
  58. }
  59. }
  60. close(F);
  61. for ($y=$size_y; $y>0; $y--) {
  62. if ($y == $size_y) { printf(" %3d |", $max_y); }
  63. elsif ($y == 1) { print " 1 |"; }
  64. else { print " |"; }
  65. for ($x=0; $x<$size_x; $x++) {
  66. if (defined $data_val[$x]) {
  67. $_ = ($data_val[$x]*$size_y*2 /
  68. $data_nr[$x]) / $max_y;
  69. if ($_ >= $y*2-1) { print ":"; }
  70. elsif ($_ >= $y*2-2) { print "."; }
  71. else { print " "; }
  72. } else {
  73. print " ";
  74. }
  75. }
  76. print "|\n";
  77. }
  78. print " -----+-----------------------------------" .
  79. "---------------------------------+\n";
  80. }
  81. printf " Jobs | 00:00 Time " .
  82. " %02d:%02d |\n\n",
  83. $max_x / 100, ($max_x * 0.6 ) % 60;