mod_tile 0.9.1
Renders map tiles with Mapnik and serves them using Apache HTTP Server
Loading...
Searching...
No Matches
render_submit_queue.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007 - 2026 by mod_tile contributors (see AUTHORS file)
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; If not, see http://www.gnu.org/licenses/.
16 */
17
18#ifndef RENDER_SUBMIT_QUEUE_H
19#define RENDER_SUBMIT_QUEUE_H
20
21#include <sys/time.h>
22
23#include "render_config.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
32 struct qItem {
34 char *mapname;
36 int x, y, z;
38 struct qItem *next;
39 };
40
44 struct speed_stat {
46 time_t time_min;
48 time_t time_max;
50 time_t time_total;
53 };
54
58 struct speed_stats {
61 };
62
63 int make_connection(const char *spath);
64 void check_load(void);
65 void display_rate(struct timeval start, struct timeval end, int num);
66 void enqueue(const char *xmlname, int x, int y, int z);
67 void finish_workers(void);
68 void print_statistics(void);
69 void spawn_workers(int num, const char *socketpath, int maxLoad);
70 void *thread_main(void *arg);
71 void wait_for_empty_queue(void);
72
73#ifdef __cplusplus
74}
75#endif
76
77#endif /* RENDER_SUBMIT_QUEUE_H */
#define MAX_ZOOM
Maximum supported map zoom level.
Definition render_config.h:24
int make_connection(const char *spath)
Open a stream connection to renderd over a Unix domain socket or TCP/IP socket.
Definition render_submit_queue.c:214
void enqueue(const char *xmlname, int x, int y, int z)
Enqueue a metatile render request onto the bounded worker submission queue.
Definition render_submit_queue.c:395
void wait_for_empty_queue(void)
Block the calling thread until all currently queued items have been popped by workers.
Definition render_submit_queue.c:600
void finish_workers(void)
Signal all worker threads to finish remaining queued items and join them.
Definition render_submit_queue.c:450
void spawn_workers(int num, const char *socketpath, int maxLoad)
Initialize synchronization primitives and spawn the pool of render-client worker threads.
Definition render_submit_queue.c:503
void display_rate(struct timeval start, struct timeval end, int num)
Log the elapsed time and average throughput (tiles/sec) for a batch of rendered tiles.
Definition render_submit_queue.c:369
void check_load(void)
Throttle worker submission while the system 1-minute load average meets or exceeds maxLoad.
Definition render_submit_queue.c:348
void print_statistics(void)
Log per-zoom-level minimum, average, maximum, and cumulative render times.
Definition render_submit_queue.c:473
void * thread_main(void *arg)
Worker thread main loop that fetches queued requests and submits them to renderd.
Definition render_submit_queue.c:548
Singly linked queue node representing a metatile job to submit to renderd.
Definition render_submit_queue.h:32
struct qItem * next
Pointer to the next queued submission item (NULL at tail).
Definition render_submit_queue.h:38
int z
Definition render_submit_queue.h:36
int x
Tile X, Y, and zoom coordinates of the metatile to render.
Definition render_submit_queue.h:36
char * mapname
Heap-allocated target map configuration (xmlname) string.
Definition render_submit_queue.h:34
int y
Definition render_submit_queue.h:36
Aggregated rendering latency and throughput counters for a single zoom level.
Definition render_submit_queue.h:44
int noRendered
Total number of metatiles rendered at this zoom level.
Definition render_submit_queue.h:52
time_t time_max
Maximum observed metatile render duration in seconds.
Definition render_submit_queue.h:48
time_t time_total
Cumulative metatile render duration in seconds across all rendered items.
Definition render_submit_queue.h:50
time_t time_min
Minimum observed metatile render duration in seconds.
Definition render_submit_queue.h:46
Per-zoom-level collection of rendering speed statistics (0 through MAX_ZOOM).
Definition render_submit_queue.h:58
struct speed_stat stat[20+1]
Array of per-zoom latency and count statistics indexed by zoom level z.
Definition render_submit_queue.h:60