| 566 | } |
| 567 | |
| 568 | void writeHeader(Buffer* buf) { |
| 569 | buf->put("FLR\0", 4); // magic |
| 570 | buf->put16(2); // major |
| 571 | buf->put16(0); // minor |
| 572 | buf->put64(1024 * 1024 * 1024); // chunk size (initially large, for JMC to skip incomplete chunk) |
| 573 | buf->put64(0); // cpool offset |
| 574 | buf->put64(0); // meta offset |
| 575 | buf->put64(_start_time * 1000); // start time, ns |
| 576 | buf->put64(0); // duration, ns |
| 577 | buf->put64(_start_ticks); // start ticks |
| 578 | // A frequency here may be inaccurate when using TSC clock. |
| 579 | // It will be overwritten with a correct value in finishChunk later. |
| 580 | buf->put64(TSC::frequency()); // ticks per sec |
| 581 | buf->put32(1); // features |
| 582 | } |
| 583 | |
| 584 | void writeMetadata(Buffer* buf) { |
| 585 | int metadata_start = buf->skip(5); // size will be patched later |