PT_BLK_GET_OFFSET(3)
π PT_BLK_GET_OFFSET(3) π
okay bestie, we're in pt_blk_get_offset(3) territory and it's literally the cutest little pair of functions. no cap. they're about peeking at where an Intel(R) Processor Trace block decoder is currently vibing inside its trace buffer. two of them. twins. iconic.
β¨ NAME β¨
pt_blk_get_offset, pt_blk_get_sync_offset β get an Intel(R) Processor Trace block decoder's current/synchronization trace buffer offset π«Ά
like. that's the whole assignment. one tells you where you are, the other tells you where you last synced. both in bytes. both adorable.
πΈ SYNOPSIS πΈ
#include <intel-pt.h>
int pt_blk_get_offset(const struct pt_block_decoder *decoder,
uint64_t *offset);
int pt_blk_get_sync_offset(const struct pt_block_decoder *decoder,
uint64_t *offset);
and then, the part nobody reads but everybody needs:
Link with -lipt.
that's it. that's the link line. don't forget it or the linker will simply end you. π
π¦ DESCRIPTION π¦
so, pt_blk_get_offset() hands you the decoder's current position, expressed as an offset in bytes from the beginning of the decoder's trace buffer, and it drops that number into the unsigned integer variable that offset is pointing at. your decoder's little "you are here" pin on the map. π
meanwhile pt_blk_get_sync_offset() gives you the decoder's last synchronization point β same deal, an offset in bytes from the beginning of the decoder's trace buffer β and it writes that into the unsigned integer variable pointed to by offset. that's the last spot where your decoder actually got its bearings. the anchor. the safe lil checkpoint. β
two functions. two offsets. both uint64_t. both giving main character energy.
π RETURN VALUE π
both of them return zero on success, or a negative pt_error_code enumeration constant if something went wrong. so like. check your return values. always. it's giving basic self-respect.
π ERRORS π
pte_invalidβ the decoder or offset argument isNULL. yeah. you passed a nothing where a something should be. we've all been there but bestie please.pte_nosyncβ decoder has not been synchronized onto the trace stream yet. it's lost. it's confused. it doesn't know where it is. usept_blk_sync_forward(3),pt_blk_sync_backward(3), orpt_blk_sync_set(3)to synchronize decoder and get it back on its feet. π§
real talk: if you get pte_nosync and you just keep calling anyway, you're not getting a number, you're getting a whole attitude from the library. sync first. periodt.
π SEE ALSO π
pt_blk_alloc_decoder(3)pt_blk_free_decoder(3)pt_blk_sync_forward(3)pt_blk_sync_backward(3)pt_blk_sync_set(3)pt_blk_get_config(3)pt_blk_time(3)pt_blk_core_bus_ratio(3)pt_blk_next(3)
the whole friend group. go read them. slay. π
and that's the page, bestie β PT_BLK_GET_OFFSET(3), signed off right there in the footer like the queen she is, source and date and all, no notes. mwah. πβ¨π
π¦ where this page comes from
- fedora 43: libipt-devel 2.1.2-3.fc43 Β· BSD-3-Clause
- fedora 43: libipt-devel 2.1.2-3.fc43 Β· BSD-3-Clause
- fedora 44: libipt-devel 2.1.2-4.fc44 Β· BSD-3-Clause
- fedora 44: libipt-devel 2.1.2-4.fc44 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms