src/share/vm/utilities/ostream.hpp

changeset 2964
2a241e764894
parent 2708
1d1603768966
child 3992
4ee06e614636
     1.1 --- a/src/share/vm/utilities/ostream.hpp	Wed Jun 08 21:48:38 2011 -0400
     1.2 +++ b/src/share/vm/utilities/ostream.hpp	Fri Jun 10 15:08:36 2011 -0700
     1.3 @@ -110,14 +110,15 @@
     1.4     // flushing
     1.5     virtual void flush() {}
     1.6     virtual void write(const char* str, size_t len) = 0;
     1.7 -   virtual ~outputStream() {}  // close properly on deletion
     1.8 +   virtual void rotate_log() {} // GC log rotation
     1.9 +   virtual ~outputStream() {}   // close properly on deletion
    1.10  
    1.11     void dec_cr() { dec(); cr(); }
    1.12     void inc_cr() { inc(); cr(); }
    1.13  };
    1.14  
    1.15  // standard output
    1.16 -                                // ANSI C++ name collision
    1.17 +// ANSI C++ name collision
    1.18  extern outputStream* tty;           // tty output
    1.19  extern outputStream* gclog_or_tty;  // stream for gc log if -Xloggc:<f>, or tty
    1.20  
    1.21 @@ -176,6 +177,7 @@
    1.22    FILE* _file;
    1.23    bool  _need_close;
    1.24   public:
    1.25 +  fileStream() { _file = NULL; _need_close = false; }
    1.26    fileStream(const char* file_name);
    1.27    fileStream(const char* file_name, const char* opentype);
    1.28    fileStream(FILE* file) { _file = file; _need_close = false; }
    1.29 @@ -210,6 +212,20 @@
    1.30    void flush() {};
    1.31  };
    1.32  
    1.33 +class rotatingFileStream : public fileStream {
    1.34 + protected:
    1.35 +  char*  _file_name;
    1.36 +  jlong  _bytes_writen;
    1.37 +  uintx  _cur_file_num;             // current logfile rotation number, from 0 to MaxGCLogFileNumbers-1
    1.38 + public:
    1.39 +  rotatingFileStream(const char* file_name);
    1.40 +  rotatingFileStream(const char* file_name, const char* opentype);
    1.41 +  rotatingFileStream(FILE* file) : fileStream(file) {}
    1.42 +  ~rotatingFileStream();
    1.43 +  virtual void write(const char* c, size_t len);
    1.44 +  virtual void rotate_log();
    1.45 +};
    1.46 +
    1.47  void ostream_init();
    1.48  void ostream_init_log();
    1.49  void ostream_exit();

mercurial