[Orca-checkins] rev 96 - in trunk/orca: . lib src

blair at orcaware.com blair at orcaware.com
Sat Jul 13 18:35:00 PDT 2002


Author: blair
Date: Fri, 28 Jun 2002 21:56:08 -0700
New Revision: 96

Removed:
   trunk/orca/INSTALL%
Modified:
   trunk/orca/CHANGES
   trunk/orca/lib/Makefile.in
   trunk/orca/src/orca.pl
Log:
Load orca-0.16 into trunk/orca.


Modified: trunk/orca/lib/Makefile.in
==============================================================================
--- trunk/orca/lib/Makefile.in	(original)
+++ trunk/orca/lib/Makefile.in	Sat Jul 13 18:34:27 2002
@@ -16,7 +16,7 @@
 
 install: all
 	$(MKDIR) $(libdir)
-	-$(CP) -p $(libdir)/percollator.cfg $(libdir)/percollator.cfg.`date +%Y-%m-%d-%H:%M:%S`
+	-cp -p $(libdir)/percollator.cfg $(libdir)/percollator.cfg.`date +%Y-%m-%d-%H:%M:%S`
 	$(INSTALL) -m 0644 percollator.cfg $(libdir)
 	$(INSTALL) -m 0644 percollator.se $(libdir)
 

Modified: trunk/orca/src/orca.pl
==============================================================================
--- trunk/orca/src/orca.pl	(original)
+++ trunk/orca/src/orca.pl	Sat Jul 13 18:34:27 2002
@@ -17,7 +17,7 @@
 
 # This is the version of this code.
 use vars qw($VERSION);
-$VERSION = 0.15;
+$VERSION = 0.16;
 
 # The number of seconds in one day.
 my $day_seconds = 24*60*60;
@@ -1597,8 +1597,9 @@
   # Load the current state of the source data files.
   my $source_file_state = &load_state($config_options->{state_file});
 
-  # The first time through we always find new files.  Calculate the time
-  # interval the current time is in.
+  # The first time through we always find new files.  Determine the
+  # time interval that the current time is in, where the intervals are
+  # defined as the times to have Orca find new source data files.
   my $find_new_files = 1;
   my $time_interval  = get_time_interval($config_options->{find_times});
 
@@ -1607,9 +1608,8 @@
   my %group_load_time;
 
   for (;;) {
-    # Get the list of files to watch and the plots that will be created.
-    # Use the previous time through new_found_files_ref if it is defined,
-    # otherwise use the old one.
+    # If Orca is being forced to find new files, then set up the variables
+    # here.  Determine the current time interval we're in.
     if ($force_find_files) {
       $force_find_files = 0;
       $find_new_files   = 1;
@@ -1618,14 +1618,17 @@
 
     my $found_new_files = 0;
     if ($find_new_files) {
+      $find_new_files = 0;
       if ($opt_verbose) {
         print "Finding files and setting up data structures at ",
               scalar localtime, ".\n";
       }
+
+      # Get the list of files to watch and the plots that will be created.
+      # If files have been previously found, then use those files in the
+      # search for new ones.
       $old_found_files_ref = $new_found_files_ref if $new_found_files_ref;
-      ($found_new_files,
-       $new_found_files_ref,
-       $group_files_ref) =
+      ($found_new_files, $new_found_files_ref, $group_files_ref) =
          &find_files($config_filename,
                      $config_options,
                      $config_files,
@@ -1634,46 +1637,52 @@
                      $old_found_files_ref,
                      $rrd_data_files_ref,
                      $gif_files_ref);
-      $find_new_files = 0;
 
-      # Go through all of the groups and find the maximum load time.
+      # Go through all of the groups and for each group and all of the files
+      # in the group find the next load time in the future.
       undef %group_load_time;
-      foreach my $group (sort keys %$group_files_ref) {
+      my $now = time;
+      foreach my $group (keys %$group_files_ref) {
         my $group_load_time = 1e20;
         foreach my $filename (@{$group_files_ref->{$group}}) {
           my $load_time    = $new_found_files_ref->{$filename}->next_load_time;
           $group_load_time = $load_time if $load_time < $group_load_time;
         }
+        if ($group_load_time < $now) {
+          die "$0: internal error: group_load_time less than current time.\n"
+        }
         $group_load_time{$group} = $group_load_time;
       }
     }
 
 #    system("/bin/ps -p $$ -o\"rss vsz pmem time user pid comm\"");
 
-    # Because the amount of data load from the source data files can be
-    # large, go through each group of source files, load all of the data
-    # for that group, flush the data, and then go on to the next group.
-    # For each source file that had new data, note the RRDs that get
-    # updated from that source file.  To decide if the data from the 
+    # Because the amount of data loaded from the source data files can
+    # be large, go through each group of source files, load all of the
+    # data for that group, flush the data, and then go on to the next
+    # group.  For each source file that had new data, note the RRDs
+    # that get updated from that source file.  When going through each
+    # group note the time when the group should be next examined for
+    # updates.  Only note the time to sleep to if it is in the future.
     my $updated_source_files = 0;
     my $sleep_till_time;
     foreach my $group (sort keys %group_load_time) {
+
+      # Skip this group if the load time has not been reached and if
+      # no new files were found.
       my $group_load_time = $group_load_time{$group};
-      $sleep_till_time    = $group_load_time unless $sleep_till_time;
       if ($group_load_time > time) {
-        if ($group_load_time < $sleep_till_time) {
-          $sleep_till_time = $group_load_time;
-        }
-        # Skip this group unless new files were found, then we need to
-        # load the data from them.
+        $sleep_till_time = $group_load_time unless $sleep_till_time;
+        $sleep_till_time = $group_load_time if $group_load_time < $sleep_till_time;
         next unless $found_new_files;
       }
 
       if ($opt_verbose) {
         print "Loading new data", $group ? " from $group" : "", ".\n";
       }
-      my $number_new_data_points = 0;
+
       my %this_group_rrds;
+      my $number_new_data_points = 0;
       $group_load_time = 1e20;
       foreach my $filename (@{$group_files_ref->{$group}}) {
         my $source_file = $new_found_files_ref->{$filename};
@@ -1691,9 +1700,17 @@
         my $load_time    = $source_file->next_load_time;
         $group_load_time = $load_time if $load_time < $group_load_time;
       }
+
       # Update the load time for this group.
       $group_load_time{$group} = $group_load_time;
 
+      # Now that the source data files have been read, recalculate the
+      # time to sleep to if the load time for this group is in the future.
+      if (time < $group_load_time) {
+        $sleep_till_time = $group_load_time unless $sleep_till_time;
+        $sleep_till_time = $group_load_time if $group_load_time < $sleep_till_time;
+      }
+
       next unless $number_new_data_points;
       $updated_source_files = 1;
 
@@ -1748,17 +1765,21 @@
       $time_interval  = $new_time_interval;
     }
 
-    # Sleep if the sleep_till_time has not passed.
-    my $now = time;
-    if ($sleep_till_time > $now) {
-      if ($opt_verbose) {
-        print "Sleeping at ",
-              scalar localtime($now),
-              " until ",
-              scalar localtime($sleep_till_time),
-              ".\n";
+    # Sleep if the sleep_till_time has not passed.  If sleep_till_time is
+    # now defined, then loop immediately.  Sleep at least one second if
+    # we need to sleep at all.
+    if ($sleep_till_time) {
+      my $now = time;
+      if ($sleep_till_time > $now) {
+        if ($opt_verbose) {
+          print "Sleeping at ",
+                scalar localtime($now),
+                " until ",
+                scalar localtime($sleep_till_time),
+                ".\n";
+        }
+        sleep($sleep_till_time - $now + 1);
       }
-      sleep($sleep_till_time - $now + 1);
     }
   }
 }

Modified: trunk/orca/CHANGES
==============================================================================
--- trunk/orca/CHANGES	(original)
+++ trunk/orca/CHANGES	Sat Jul 13 18:34:27 2002
@@ -1,3 +1,13 @@
+Tue Jan 26 10:07:40 PST 1999
+
+	Fix a bug in lib/Makefile.in where the variable $(CP) was used
+	but never defined.
+
+	Fix a bug where watch_data_sources() would do an extra loop
+	each time file updates were looked for.
+
+	Version 0.16.
+
 Mon Jan 25 15:25:12 PST 1999
 
 	Update to use RRDtool 0.99.1.

Deleted: trunk/orca/INSTALL%




More information about the Orca-checkins mailing list