optick icon indicating copy to clipboard operation
optick copied to clipboard

Improvements to the C API

Open Honeybunch opened this issue 3 years ago • 1 comments

I've been finding myself in the situation where I'm working with C code and I really want to instrument it with Optick. However there were some features in the C API that I thought could be improved. I also wanted to create some sort of document of how the C API is currently intended to be used. Just to make it a bit easier for people to grok in the future.

I made a fairly substantial change to OptickAPI_CreateEventDescription which I imagine may be unpopular. Using null-terminated C strings felt a bit more convenient for this method. But if optick maintainers consider this code-smell I can revert this change to the API.

Another decision that may be contentious in this change is the way I implemented the Categories for the C API. C has no way to make a 64-bit enum so I had to settle for crafting static 64-bit values with macros like some sort of caveman. I imagine the idea of having to maintain default categories in two different source files feels like a fragile idea but I couldn't come up with a better one.

Honeybunch avatar May 31 '21 22:05 Honeybunch

Ive been using your C branch and it works like a charm. Had troubles getting the master capi to work on my project. Hope these changes make it in.

RobertLemmens avatar Jan 04 '22 16:01 RobertLemmens

Sorry I haven't had time to tackle this and I don't know if I'll be able to get back to it so I'm closing this.

Honeybunch avatar May 07 '24 01:05 Honeybunch