X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=trace_writer.hpp;h=dfb76b2508a4bac02f455b9d570cc733c5492f9a;hb=e5592342cb5d8b357fb68946a9405542b517985a;hp=20a153093f4fc0b5d0f95411b0833ab5482a1657;hpb=de6cfa776014ca36679a225f95b05b0b1e956cf2;p=apitrace diff --git a/trace_writer.hpp b/trace_writer.hpp index 20a1530..dfb76b2 100644 --- a/trace_writer.hpp +++ b/trace_writer.hpp @@ -39,10 +39,11 @@ namespace Trace { + class File; class Writer { protected: - void *g_gzFile; + File *m_file; unsigned call_no; std::vector functions; @@ -115,7 +116,15 @@ namespace Trace { */ class LocalWriter : public Writer { protected: + int acquired; + public: + /** + * Should never called directly -- use localWriter singleton below instead. + */ + LocalWriter(); + ~LocalWriter(); + void open(void); unsigned beginEnter(const FunctionSig *sig); @@ -123,7 +132,14 @@ namespace Trace { void beginLeave(unsigned call); void endLeave(void); + + void flush(void); }; + + /** + * Singleton. + */ + extern LocalWriter localWriter; } #endif /* _TRACE_WRITER_HPP_ */