Ignore:
Timestamp:
Oct 11, 2001, 10:15:50 PM (24 years ago)
Author:
aubourg
Message:

bug getMaxIn

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ArchTOIPipe/Kernel/toimanager.cc

    r1653 r1684  
    11#include "toimanager.h"
    2 #include <unistd.h>
    32#include <limits.h>
    43#include <pthread.h>
    54#include <iostream.h>
    65
     6#ifndef MAXINT
     7#define MAXINT 2147483647
     8#endif
     9
    710TOIManager::TOIManager() {
    811  reqBegin = 0;
    9   reqEnd = LONG_MAX;
     12  reqEnd = MAXINT;
    1013}
    1114
     
    1720}
    1821
    19 void TOIManager::setRequestedSample(long begin, long end) {
     22void TOIManager::setRequestedSample(int begin, int end) {
    2023  reqBegin = begin;
    2124  reqEnd   = end;
    2225}
    2326
    24 long TOIManager::getRequestedBegin() {
     27int TOIManager::getRequestedBegin() {
    2528  return reqBegin;
    2629}
    2730
    28 long TOIManager::getRequestedEnd() {
     31int TOIManager::getRequestedEnd() {
    2932  return reqEnd;
    3033}
     
    4447  }
    4548}
    46 
    47 
    48 // -----------------------------------------------------------------
    49 //    Classe pour affichage de l'avancement des TOIProcessors
    50 //                         Reza 08/2001
    51 // -----------------------------------------------------------------
    52 
    53 RzProcSampleCounter::RzProcSampleCounter()
    54 {
    55   _msg = "SampleCounter/Info";
    56   _rate = 50;
    57 }
    58 
    59 RzProcSampleCounter::~RzProcSampleCounter()
    60 {
    61 }
    62 
    63 long RzProcSampleCounter::PrintStats()
    64 {
    65   int istart = 0;
    66   int iend = 0;
    67   long dns_print = 1000;
    68   int dns_print_fac = _rate;
    69   int nbmax_dns_print = 2;
    70 
    71   TOIManager* mgr = TOIManager::getManager();
    72  
    73   istart = mgr->getRequestedBegin();
    74   iend = mgr->getRequestedEnd();
    75  
    76   dns_print = (iend-istart)/dns_print_fac;
    77   if (dns_print < 1000) dns_print = ((iend-istart) < 1000) ? (iend-istart) : 1000;
    78   if (dns_print < 1) dns_print = 1;
    79   nbmax_dns_print = (iend-istart)/dns_print;
    80 
    81   cout << "RzProcSampleCounter::PrintStats() InfoMessage=" << _msg
    82        << "\n ... " << _msg << " istart="
    83        << istart << " iend= " << iend << " dns_print= " << dns_print
    84        << " nbmax_dns_print= " << nbmax_dns_print << endl;
    85   // ------------------- Impression continu de stat ------------------------
    86   long nb_dns_print = 0;
    87   int nb_sleep = 0;
    88   long last_sample_count = 0;
    89   long processed_samples = 0;
    90   long total_sample_count = dns_print*nbmax_dns_print;
    91   bool alldone = false;
    92   while (!alldone) {
    93     processed_samples = ProcessedSampleCount();
    94     if ( (processed_samples-last_sample_count > dns_print) ||
    95          (processed_samples > total_sample_count-10) ) {
    96       last_sample_count = processed_samples;
    97       if (nb_dns_print == 0) cout << "\n";
    98       nb_dns_print++;
    99       cout << ">>> " << _msg << ": ProcessedSampleCount()= " << last_sample_count
    100            << " Frac done = " << processed_samples*100/total_sample_count << " %" << endl;
    101       if (last_sample_count > total_sample_count-10)  alldone = true;
    102       nb_sleep = 0;
    103     }
    104     else if ((nb_sleep+1)%5 == 0)
    105       cout << "> " << _msg << ": ProcSamples()= " <<  processed_samples
    106            << " Done = " << " %" << processed_samples*100/total_sample_count
    107            << " NbSleep(1) = " << nb_sleep << endl;
    108    
    109     sleep(1);  nb_sleep++;
    110   }
    111  
    112   // -----------------------------------------------------------------------
    113  
    114   return last_sample_count;
    115 
    116 }
Note: See TracChangeset for help on using the changeset viewer.