// Interface for a compression implementation. class AbstractCompressor : public CHeapObj<mtInternal> { public: virtual ~AbstractCompressor() { }
// Initializes the compressor. Returns a static error message in case of an error. // Otherwise initializes the needed out and tmp size for the given block size. virtual char const* init(size_t block_size, size_t* needed_out_size,
size_t* needed_tmp_size) = 0;
// Does the actual compression. Returns NULL on success and a static error // message otherwise. Sets the 'compressed_size'. virtual char const* compress(char* in, size_t in_size, char* out, size_t out_size,
char* tmp, size_t tmp_size, size_t* compressed_size) = 0;
};
// Interface for a writer implementation. class AbstractWriter : public CHeapObj<mtInternal> { public: virtual ~AbstractWriter() { }
// Opens the writer. Returns NULL on success and a static error message otherwise. virtual char const* open_writer() = 0;
// Does the write. Returns NULL on success and a static error message otherwise. virtual char const* write_buf(char* buf, ssize_t size) = 0;
};
// A writer for a file. class FileWriter : public AbstractWriter { private:
char const* _path; bool _overwrite;
int _fd;
// Return true if the list is empty. bool is_empty() { return _head._next == &_head; }
// Adds to the beginning of the list. void add_first(WriteWork* work) { insert(&_head, work); }
// Adds to the end of the list. void add_last(WriteWork* work) { insert(_head._prev, work); }
// Adds so the ids are ordered. void add_by_id(WriteWork* work);
// Returns the first element.
WriteWork* first() { return is_empty() ? NULL : _head._next; }
// Returns the last element.
WriteWork* last() { return is_empty() ? NULL : _head._prev; }
// Removes the first element. Returns NULL if empty.
WriteWork* remove_first() { return remove(first()); }
// Removes the last element. Returns NULL if empty.
WriteWork* remove_last() { return remove(first()); }
};
class Monitor;
// This class is used by the DumpWriter class. It supplies the DumpWriter with // chunks of memory to write the heap dump data into. When the DumpWriter needs a // new memory chunk, it calls get_new_buffer(), which commits the old chunk used // and returns a new chunk. The old chunk is then added to a queue to be compressed // and then written in the background. class CompressionBackend : StackObj { bool _active;
char const * _err;
int _nr_of_threads;
int _works_created; bool _work_creation_failed;
public: // compressor can be NULL if no compression is used. // Takes ownership of the writer and compressor. // block_size is the buffer size of a WriteWork. // max_waste is the maximum number of bytes to leave // empty in the buffer when it is written.
CompressionBackend(AbstractWriter* writer, AbstractCompressor* compressor,
size_t block_size, size_t max_waste);
~CompressionBackend();
size_t get_written() const { return _written; }
char const* error() const { return _err; }
// Sets up an internal buffer, fills with external buffer, and sends to compressor. void flush_external_buffer(char* buffer, size_t used, size_t max);
// Commits the old buffer (using the value in *used) and sets up a new one. void get_new_buffer(char** buffer, size_t* used, size_t* max, bool force_reset = false);
// The entry point for a worker thread. void thread_loop();
// Shuts down the backend, releasing all threads. void deactivate();
// Flush all compressed data in buffer to file void flush_buffer();
};
#endif// SHARE_SERVICES_HEAPDUMPERCOMPRESSION_HPP
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.7 Sekunden
(vorverarbeitet am 2026-09-04)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.