mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Add an option to run mostly synchronously for profiling
This commit is contained in:
+1
-1
@@ -302,7 +302,7 @@ void fgbRunQueue() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < CPUS; i++) {
|
for (size_t i = 0; i < CPUS; i++) {
|
||||||
if (pthread_create(&pthreads[i], NULL, fgb_run_parse_feature, &qra[i]) != 0) {
|
if (pthread_create_wrap(&pthreads[i], NULL, fgb_run_parse_feature, &qra[i]) != 0) {
|
||||||
perror("pthread_create");
|
perror("pthread_create");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -464,7 +464,7 @@ void runQueue() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < CPUS; i++) {
|
for (size_t i = 0; i < CPUS; i++) {
|
||||||
if (pthread_create(&pthreads[i], NULL, run_parse_feature, &qra[i]) != 0) {
|
if (pthread_create_wrap(&pthreads[i], NULL, run_parse_feature, &qra[i]) != 0) {
|
||||||
perror("pthread_create");
|
perror("pthread_create");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -468,7 +468,7 @@ void do_read_parallel(char *map, long long len, long long initial_offset, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < CPUS; i++) {
|
for (size_t i = 0; i < CPUS; i++) {
|
||||||
if (pthread_create(&pthreads[i], NULL, run_parse_json, &pja[i]) != 0) {
|
if (pthread_create_wrap(&pthreads[i], NULL, run_parse_json, &pja[i]) != 0) {
|
||||||
perror("pthread_create");
|
perror("pthread_create");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@@ -682,7 +682,7 @@ void start_parsing(int fd, STREAM *fp, long long offset, long long len, std::ato
|
|||||||
rpa->want_dist = want_dist;
|
rpa->want_dist = want_dist;
|
||||||
rpa->filters = filters;
|
rpa->filters = filters;
|
||||||
|
|
||||||
if (pthread_create(parallel_parser, NULL, run_read_parallel, rpa) != 0) {
|
if (pthread_create_wrap(parallel_parser, NULL, run_read_parallel, rpa) != 0) {
|
||||||
perror("pthread_create");
|
perror("pthread_create");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@@ -877,7 +877,7 @@ void radix1(int *geomfds_in, int *indexfds_in, int inputs, int prefix, int split
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (size_t a = 0; a < CPUS; a++) {
|
for (size_t a = 0; a < CPUS; a++) {
|
||||||
if (pthread_create(&pthreads[a], NULL, run_sort, &args[a]) != 0) {
|
if (pthread_create_wrap(&pthreads[a], NULL, run_sort, &args[a]) != 0) {
|
||||||
perror("pthread_create");
|
perror("pthread_create");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@@ -2789,6 +2789,7 @@ int main(int argc, char **argv) {
|
|||||||
{"check-polygons", no_argument, &additional[A_DEBUG_POLYGON], 1},
|
{"check-polygons", no_argument, &additional[A_DEBUG_POLYGON], 1},
|
||||||
{"no-polygon-splitting", no_argument, &prevent[P_POLYGON_SPLIT], 1},
|
{"no-polygon-splitting", no_argument, &prevent[P_POLYGON_SPLIT], 1},
|
||||||
{"prefer-radix-sort", no_argument, &additional[A_PREFER_RADIX_SORT], 1},
|
{"prefer-radix-sort", no_argument, &additional[A_PREFER_RADIX_SORT], 1},
|
||||||
|
{"single-threaded", no_argument, &prevent[P_THREADS], 1},
|
||||||
{"help", no_argument, 0, 'H'},
|
{"help", no_argument, 0, 'H'},
|
||||||
|
|
||||||
{0, 0, 0, 0},
|
{0, 0, 0, 0},
|
||||||
@@ -3451,3 +3452,16 @@ bool progress_time() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void *donothing(void *arg) {
|
||||||
|
return arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pthread_create_wrap(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg) {
|
||||||
|
if (prevent[P_THREADS]) {
|
||||||
|
void *ret = start_routine(arg);
|
||||||
|
return pthread_create(thread, attr, donothing, ret);
|
||||||
|
} else {
|
||||||
|
return pthread_create(thread, attr, start_routine, arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -72,4 +72,6 @@ bool progress_time();
|
|||||||
|
|
||||||
#define MAX_ZOOM 24
|
#define MAX_ZOOM 24
|
||||||
|
|
||||||
|
int pthread_create_wrap(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
#define P_REVERSE_SOURCE_POLYGON_WINDING ((int) 'W')
|
#define P_REVERSE_SOURCE_POLYGON_WINDING ((int) 'W')
|
||||||
#define P_EMPTY_CSV_COLUMNS ((int) 'e')
|
#define P_EMPTY_CSV_COLUMNS ((int) 'e')
|
||||||
#define P_BASEZOOM_ABOVE_MAXZOOM ((int) 'b')
|
#define P_BASEZOOM_ABOVE_MAXZOOM ((int) 'b')
|
||||||
|
#define P_THREADS ((int) 'T')
|
||||||
|
|
||||||
extern int prevent[256];
|
extern int prevent[256];
|
||||||
extern int additional[256];
|
extern int additional[256];
|
||||||
|
|||||||
@@ -141,6 +141,10 @@ std::string format_commandline(int argc, char **argv) {
|
|||||||
std::string out;
|
std::string out;
|
||||||
|
|
||||||
for (int i = 0; i < argc; i++) {
|
for (int i = 0; i < argc; i++) {
|
||||||
|
if (std::string(argv[i]) == "-pT") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
bool need_quote = false;
|
bool need_quote = false;
|
||||||
for (char *cp = argv[i]; *cp != '\0'; cp++) {
|
for (char *cp = argv[i]; *cp != '\0'; cp++) {
|
||||||
if (!isalpha(*cp) && !isdigit(*cp) &&
|
if (!isalpha(*cp) && !isdigit(*cp) &&
|
||||||
|
|||||||
@@ -2225,8 +2225,8 @@ long long write_tile(FILE *geoms, std::atomic<long long> *geompos_in, char *meta
|
|||||||
args[i].shared_nodes = &shared_nodes;
|
args[i].shared_nodes = &shared_nodes;
|
||||||
|
|
||||||
if (tasks > 1) {
|
if (tasks > 1) {
|
||||||
if (pthread_create(&pthreads[i], NULL, partial_feature_worker, &args[i]) != 0) {
|
if (pthread_create_wrap(&pthreads[i], NULL, partial_feature_worker, &args[i]) != 0) {
|
||||||
perror("pthread_create");
|
perror("pthread_create_wrap");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -2980,8 +2980,8 @@ int traverse_zooms(int *geomfd, off_t *geom_size, char *metabase, char *stringpo
|
|||||||
args[thread].still_dropping = false;
|
args[thread].still_dropping = false;
|
||||||
args[thread].strategy = &strategy;
|
args[thread].strategy = &strategy;
|
||||||
|
|
||||||
if (pthread_create(&pthreads[thread], NULL, run_thread, &args[thread]) != 0) {
|
if (pthread_create_wrap(&pthreads[thread], NULL, run_thread, &args[thread]) != 0) {
|
||||||
perror("pthread_create");
|
perror("pthread_create_wrap");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user