Replies: 1 comment
-
However, I'm not sure about doing 3+4 in the short term. These feel like good/useful features to have, but I think the priority should be getting traction. I don't think they'd influence whether cppcon is accepted talk. Over the years I have discovered that programming is a lot easier than marketing, but marketing is more important :) (Except for fixing |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This thread proposes a small collection of revisions to core L3 interfaces. The main motivation is to have a standard interface in user-programs, especially performance u-benchmarking toolkits like client-server-msgs-perf, so that we can run workloads against different types of logging-interfaces.
These revised interfaces may be useful even for general user-applications, beyond simply for performance benchmarking. Not all need to be done together. We can discuss and choose to implement some of these incrementally.
Proposed extensions to L3 interfaces
l3_init()to take a logging-type argument, to choose betweenmmap(),fprintf(),write(),spdlogetc.l3_log_simple()to be simplyl3_log(), with mmap()'ed logging being the default.L3_ENTRY{}. Or, cache L3_LOG->idx counter as a proxy.mmap()-ed file.NOTE: I plan to prorotype some of these suggested changes in part to address the asks in issue #43, while working on extended performance benchmarking in a dev-branch. That experience will guide us towards making an informed choice between these approaches.
Details
l3_init()to take a logging-type argument, to choose betweenmmap(),fprintf(),write(),spdlogetc.Suggested interface is something like:
l3_init(enum_t l3_log_type, const char *log_file)Possible enumerated types to support are:
Current usage of:
Will change to something like:
In case
L3_LOG_FPRINTForL3_LOG_WRITEis used, we willfopen()oropen(), respectively, the specified log-file to return either aFILE *or a file-descriptor and it will be appropriately used in subsequent logging calls.l3_log_simple()to be simplyl3_log(), with mmap()'ed logging being the default.This is a naming simplification.
l3_log()is the default logging scheme tommap()-ed file.Other interfaces would be on the lines of:
l3_log_stdout(),l3_log_fprintf(),l3_log_write(),l3_log_spdlog(), ... Details to be worked out during finer designs.L3_ENTRY{}. Or, cache L3_LOG->idx counter as a proxy.The 1st comment I get when discussing current interfaces is whether we will save-off a time stamp for the log-entry. Currently we are not doing that.
Not having a timestamp makes it difficult for the user to map the dumped log-entry to some sequence of time.
Specifically when the log-contents roll-over in an
mmap()-ed file, it becomes difficult to know what the most recent and latest log entry is.We can do one of few things:
Stash away the log's index; i.e.
L3_LOG->idxalong with the log-entry. This will at least establish some sequencing across log entries.The dump script should, by default, spit out log-entries in sorted order. This will make diagnostics easier to figure out the sequence of logged entries.
Cache a hi-resolution time stamp, say RDTSC — Read Time-Stamp Counter, which is available on Intel processors. This Medium article explains how-to use this
__rdtsc()interface. Quoting from this article:"The best solution is of course to use the RDTSC function which counts ticks in clock cycles of the CPU; that means for every tick registered by the RDTSC one iteration or one cycle of the CPU has taken place. "
mmap()-ed file, by addingl3_deinit().Currently the user's program has no way to turn OFF logging.
Consider a way to start / suspend / resume / stop logging through extensions that play with
mmap(),munmap()and so on. Suspend / resume may just be L3-local state variables:l3_init()or,l3_log_init()l3_pause(). or,l3_log_pause()or,l3_log_suspend()l3_resume(). or,l3_log_resume()l3_deinit(). or,l3_log_stop()Beta Was this translation helpful? Give feedback.
All reactions