comparison src/share/vm/utilities/ostream.hpp @ 17827:f42c10a3d4b1

7090324: gclog rotation via external tool Summary: GC log rotation can be set via java command line, but customer sometime need to sync with OS level rotation setting. Reviewed-by: sla, minqi, ehelin Contributed-by: suenaga.yasumasa@lab.ntt.co.jp
author minqi
date Mon, 31 Mar 2014 13:09:35 -0700
parents 55fb97c4c58d
children 78bbf4d43a14
comparison
equal deleted inserted replaced
17826:d5818eeedb40 17827:f42c10a3d4b1
113 void print_julong(julong value); 113 void print_julong(julong value);
114 114
115 // flushing 115 // flushing
116 virtual void flush() {} 116 virtual void flush() {}
117 virtual void write(const char* str, size_t len) = 0; 117 virtual void write(const char* str, size_t len) = 0;
118 virtual void rotate_log() {} // GC log rotation 118 virtual void rotate_log(bool force, outputStream* out = NULL) {} // GC log rotation
119 virtual ~outputStream() {} // close properly on deletion 119 virtual ~outputStream() {} // close properly on deletion
120 120
121 void dec_cr() { dec(); cr(); } 121 void dec_cr() { dec(); cr(); }
122 void inc_cr() { inc(); cr(); } 122 void inc_cr() { inc(); cr(); }
123 }; 123 };
238 uintx _cur_file_num; // current logfile rotation number, from 0 to NumberOfGCLogFiles-1 238 uintx _cur_file_num; // current logfile rotation number, from 0 to NumberOfGCLogFiles-1
239 public: 239 public:
240 gcLogFileStream(const char* file_name); 240 gcLogFileStream(const char* file_name);
241 ~gcLogFileStream(); 241 ~gcLogFileStream();
242 virtual void write(const char* c, size_t len); 242 virtual void write(const char* c, size_t len);
243 virtual void rotate_log(); 243 virtual void rotate_log(bool force, outputStream* out = NULL);
244 void dump_loggc_header(); 244 void dump_loggc_header();
245
246 /* If "force" sets true, force log file rotation from outside JVM */
247 bool should_rotate(bool force) {
248 return force ||
249 ((GCLogFileSize != 0) && ((uintx)_bytes_written >= GCLogFileSize));
250 }
251
245 }; 252 };
246 253
247 #ifndef PRODUCT 254 #ifndef PRODUCT
248 // unit test for checking -Xloggc:<filename> parsing result 255 // unit test for checking -Xloggc:<filename> parsing result
249 void test_loggc_filename(); 256 void test_loggc_filename();