Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow full instrumentation of internal operations #5

Open
jaypipes opened this issue Jan 23, 2018 · 0 comments
Open

allow full instrumentation of internal operations #5

jaypipes opened this issue Jan 23, 2018 · 0 comments
Assignees

Comments

@jaypipes
Copy link
Owner

In order to determine where sqltoast is spending its time during tokenization and parsing efforts, I'd like to provide full instrumentation of all primary functions. The instrumentation "interface" should look something like this:

#include <iostream>
#include <cctype>

#include <sqltoast.h>
sqltoast::parse_input_t subject("CREATE SCHEMA s1");
sqltoast::parse_options_t opts;
opts.enable_instrumentation = true;

auto res = sqltoast::parse(subject, opts);
for (auto instr = res.instrumentation) {
    std::cout << instr.block << ": " << instr.total_ns << " nanoseconds" << std::endl;    
}

which would output something like this:

tokenize(): 31880 nanoseconds
 -> token_comment(): 678 nanoseconds
 -> token_keyword(): 23449 nanoseconds
 -> token_identifier(): 6777 nanoseconds
parse_statement(): 1156 nanoseconds
 -> parse_create_schema(): 928 nanoseconds
@jaypipes jaypipes self-assigned this Jan 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant