Skip to content

Conversation

horgh
Copy link
Contributor

@horgh horgh commented Nov 24, 2017

This is similar to the existing benchmark mode, but runs in several
threads.

@horgh horgh force-pushed the will2/multithreaded-mmdblookup branch from de969ca to 78aabad Compare November 25, 2017 20:59
This is similar to the existing benchmark mode, but runs in several
threads.
@horgh horgh force-pushed the will2/multithreaded-mmdblookup branch from 78aabad to ec604d7 Compare November 25, 2017 21:15
@horgh horgh changed the title [WIP] Add a way to run multithreaded lookups in mmdblookup Add a way to run multithreaded lookups in mmdblookup Nov 25, 2017
@horgh
Copy link
Contributor Author

horgh commented Nov 25, 2017

Not too certain about the Windows detection here.

Also, perhaps this would be better as a separate program, or be combined more with the existing benchmark code. Possibly it doesn't belong in this repo at all. I did find it useful for finding one race, so I think it or something like it would be good to have somewhere.

Copy link
Member

@oschwald oschwald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable, but I think the ifdefs could be simpler.

bin/mmdblookup.c Outdated
@@ -131,13 +164,14 @@ LOCAL const char **get_options(int argc, char **argv, char **mmdb_file,
{ "verbose", no_argument, 0, 'v' },
{ "version", no_argument, 0, 'n' },
{ "benchmark", required_argument, 0, 'b' },
{ "threads", required_argument, 0, 't' },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we remove this option on Windows?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea.

bin/mmdblookup.c Outdated
int const iterations)
{
#ifdef _WIN32
return false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just remove the function definitions for these on Windows altogether and remove the following?

if (thread_count > 0) {
if (!start_threaded_benchmark(&mmdb, thread_count, iterations)) {
MMDB_close(&mmdb);
exit(1);
}
MMDB_close(&mmdb);
exit(0);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's nicer. Mainly I was trying to work around regen-prototypes.pl not being happy with macros (it deletes them from its section). I found a different workaround that seems better, although is still a bit ugly what with the extra NO_PROTOTYPE macro. I wonder if we need regen-prototypes.pl. It's not a huge pain to keep them up to date manually and would avoid this problem.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I would be fine getting rid of that script. I don't find it particularly useful.

@oschwald oschwald merged commit 9e9eab9 into master Dec 4, 2017
@oschwald oschwald deleted the will2/multithreaded-mmdblookup branch December 4, 2017 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants