MCPcopy Create free account
hub / github.com/GameTechDev/PresentMon / GetStringPropertyInfo

Function GetStringPropertyInfo

PresentData/TraceConsumer.cpp:33–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31
32template<typename T>
33void GetStringPropertyInfo(TRACE_EVENT_INFO const& tei, EVENT_RECORD const& eventRecord, uint32_t index, uint32_t offset,
34 PropertyInfo* info)
35{
36 auto const& epi = tei.EventPropertyInfoArray[index];
37
38 if ((epi.Flags & PropertyParamLength) != 0) {
39 assert(false); // TODO: just not implemented yet
40 info->size_ = 0;
41 } else if (epi.length != 0) {
42 info->size_ = epi.length * sizeof(T);
43 } else {
44 if (offset == UINT32_MAX) {
45 offset = GetPropertyDataOffset(tei, eventRecord, index);
46 assert(offset <= eventRecord.UserDataLength);
47 }
48
49 for (uint32_t size = 0;; size += sizeof(T)) {
50 if (offset + size > eventRecord.UserDataLength) {
51 // string ends at end of block, possibly ok (see note above)
52 // paranoia check addressing coverity issue, likely not relevant
53 assert(size >= sizeof(T));
54 info->size_ = size - sizeof(T);
55 break;
56 }
57 if (*(T const*) ((uintptr_t) eventRecord.UserData + offset + size) == (T) 0) {
58 info->status_ |= PROP_STATUS_NULL_TERMINATED;
59 info->size_ = size + sizeof(T);
60 break;
61 }
62 }
63 }
64}
65
66PropertyInfo GetPropertyInfo(TRACE_EVENT_INFO const& tei, EVENT_RECORD const& eventRecord, uint32_t index, uint32_t offset)
67{

Callers

nothing calls this directly

Calls 1

GetPropertyDataOffsetFunction · 0.85

Tested by

no test coverage detected