PT_ENC_GET_OFFSET(3)

πŸ“¦ version 2.1.2, in fedora 43, fedora 44

πŸ’– PT_ENC_GET_OFFSET β€” bestie edition πŸ’–

okay so real talk, this page is about pt_enc_get_offset and pt_enc_sync_set from the intel-pt crew β€” they're the ones who get and set an Intel(R) Processor Trace packet encoder's current trace buffer offset. two little functions, one big vibe, let's go ✨


✨ NAME ✨

pt_enc_get_offset, pt_enc_sync_set β€” get/set an Intel(R) Processor Trace packet encoder's current trace buffer offset πŸŽ€


🌸 SYNOPSIS 🌸

#include <intel-pt.h>
int pt_enc_get_offset(const struct pt_packet_encoder *encoder,
                      uint64_t *offset);
int pt_enc_sync_set(const struct pt_packet_encoder *encoder,
                    uint64_t offset);

Link with -lipt.

no cap, that Link with -lipt. is not optional, bestie, that's literally how you get these functions at all πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so pt_enc_get_offset() is the little gossip girl of the pair: it tells you the encoder's current position, expressed as an offset in bytes from the beginning of the encoder's trace buffer, and it drops that number into the unsigned integer variable that offset points to. it's giving "where am i right now, be honest" πŸ’–

then pt_enc_sync_set() is the main character move: it sets the encoder's current position to offset bytes from the beginning of its trace buffer. like, we're manifesting a new location. periodt ✨


πŸ”₯ RETURN VALUE πŸ”₯

both of these return zero on success, or a negative pt_error_code enumeration constant if something went wrong 😭 that negative is your sign, bestie.


πŸ’€ ERRORS πŸ’€

  • pte_invalid β€” the encoder argument is NULL, or (for pt_enc_sync_set() only) the offset argument is NULL. someone passed a whole nothing. πŸ™ˆ
  • pte_eos β€” the offset argument is too big, and the resulting position would land outside of the encoder's trace buffer. heads up, this one is pt_enc_sync_set() only. you tried to sync somewhere that doesn't exist, and the encoder said no 🚫
fr fr, don't go setting offsets past the end of the buffer and expect it to just work. pte_eos is waiting for you.

πŸ‘‘ SEE ALSO πŸ‘‘

go read those next, iykyk 🧚


and that's the whole page, babe β€” the footer at the bottom is just PT_ENC_GET_OFFSET(3) again, waving goodbye like the icon it is πŸ’œπŸŒˆ

πŸ“¦ where this page comes from