< prev index next >

src/share/vm/utilities/ostream.hpp

Print this page

        

*** 25,34 **** --- 25,35 ---- #ifndef SHARE_VM_UTILITIES_OSTREAM_HPP #define SHARE_VM_UTILITIES_OSTREAM_HPP #include "memory/allocation.hpp" #include "runtime/timer.hpp" + #include "runtime/task.hpp" class GCId; DEBUG_ONLY(class ResourceMark;) // Output streams for printing
*** 233,262 **** --- 234,291 ---- int fd() const { return _fd; } virtual void write(const char* c, size_t len); void flush() {}; }; + class Mutex; + class GCLogEvent; + class gcLogFileStream : public fileStream { protected: const char* _file_name; jlong _bytes_written; uintx _cur_file_num; // current logfile rotation number, from 0 to NumberOfGCLogFiles-1 + private: + GCLogEvent* _reader; + GCLogEvent* _writer; + Mutex* _lock; + public: gcLogFileStream(const char* file_name); ~gcLogFileStream(); + // write asynchronously virtual void write(const char* c, size_t len); + // really write to file system. + void write_blocking(const char* c, size_t len); virtual void rotate_log(bool force, outputStream* out = NULL); + void flush_log(); void dump_loggc_header(); /* If "force" sets true, force log file rotation from outside JVM */ bool should_rotate(bool force) { return force || ((GCLogFileSize != 0) && ((uintx)_bytes_written >= GCLogFileSize)); } }; + class GCLogFlusher: public PeriodicTask { + gcLogFileStream * _ostream; + elapsedTimer _accumulatedTime; + public: + GCLogFlusher(int interval, gcLogFileStream* ostream):PeriodicTask(interval), _ostream(ostream) {} + + virtual void task() { + TraceTime t("GCLogFlusher", &_accumulatedTime, true, PrintGCLogFlushTime); + _ostream->flush_log(); + } + + elapsedTimer getAccumulatedTime() { + return _accumulatedTime; + } + }; + #ifndef PRODUCT // unit test for checking -Xloggc:<filename> parsing result void test_loggc_filename(); void test_snprintf(); #endif
< prev index next >