40#include <qb/qbipc_common.h>
78static void message_handler_req_exec_pload_start (
const void *msg,
80static void req_exec_pload_start_endian_convert (
void *msg);
82static void message_handler_req_exec_pload_mcast (
const void *msg,
84static void req_exec_pload_mcast_endian_convert (
void *msg);
90 .exec_endian_convert_fn = req_exec_pload_start_endian_convert
93 .exec_handler_fn = message_handler_req_exec_pload_mcast,
94 .exec_endian_convert_fn = req_exec_pload_mcast_endian_convert
105static char *buffer = NULL;
111static uint32_t msgs_wanted = 0;
112static uint32_t msg_size = 0;
113static uint32_t msgs_sent = 0;
114static uint32_t msgs_delivered = 0;
119static uint8_t pload_started = 0;
129static unsigned long long int tv1;
130static unsigned long long int tv2;
131static unsigned long long int tv_elapsed;
137 .
name =
"corosync profile loading service",
141 .exec_engine = pload_exec_engine,
143 .exec_init_fn = pload_exec_init_fn
160#warning Using internal timersub definition. Check your include header files
161#define timersub(a, b, result) \
163 (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
164 (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
165 if ((result)->tv_usec < 0) { \
166 --(result)->tv_sec; \
167 (result)->tv_usec += 1000000; \
175static void pload_send_start (uint32_t count, uint32_t size)
192static int pload_send_message (
const void *arg)
197 unsigned int iov_len = 1;
205 iov[1].iov_base = &buffer;
217 }
while (msgs_sent < msgs_wanted);
219 if (msgs_sent == msgs_wanted) {
230static void pload_read_config(
232 const char *key_name,
237 uint32_t pload_count = 1500000;
238 uint32_t pload_size = 300;
239 char *pload_start = NULL;
249 if ((!pload_started) &&
251 if (!strcmp(pload_start,
252 "i_totally_understand_pload_will_crash_my_cluster_and_kill_corosync_on_exit")) {
253 buffer = malloc(pload_size);
256 pload_send_start(pload_count, pload_size);
259 "Unable to allocate pload buffer!");
282 &pload_track) !=
CS_OK) {
283 return (
char *)
"Unable to setup pload config tracking!\n";
293static void req_exec_pload_start_endian_convert (
void *msg)
301static void message_handler_req_exec_pload_start (
320 &start_mcasting_handle,
322 &start_mcasting_handle);
325static void req_exec_pload_mcast_endian_convert (
void *msg)
329static void message_handler_req_exec_pload_mcast (
333 char log_buffer[1024];
335 if (msgs_delivered == 0) {
336 tv1 = qb_util_nano_current_get ();
339 if (msgs_delivered == msgs_wanted) {
340 tv2 = qb_util_nano_current_get ();
341 tv_elapsed = tv2 - tv1;
342 sprintf (log_buffer,
"%5d Writes %d bytes per write %7.3f seconds runtime, %9.3f TP/S, %9.3f MB/S.",
345 (tv_elapsed / 1000000000.0),
346 ((
float)msgs_delivered) / (tv_elapsed / 1000000000.0),
347 (((
float)msgs_delivered) * ((
float)
msg_size) /
348 (tv_elapsed / 1000000000.0)) / (1024.0 * 1024.0));
#define SERVICE_ID_MAKE(a, b)
@ CS_LIB_FLOW_CONTROL_REQUIRED
#define ICMAP_TRACK_MODIFY
cs_error_t icmap_get_uint32(const char *key_name, uint32_t *u32)
#define ICMAP_TRACK_DELETE
cs_error_t icmap_track_add(const char *key_name, int32_t track_type, icmap_notify_fn_t notify_fn, void *user_data, icmap_track_t *icmap_track)
Add tracking function for given key_name.
#define ICMAP_TRACK_PREFIX
Whole prefix is tracked, instead of key only (so "totem." tracking means that "totem....
cs_error_t icmap_get_string(const char *key_name, char **str)
Shortcut for icmap_get for string type.
#define log_printf(level, format, args...)
#define LOGSYS_LEVEL_NOTICE
#define LOGSYS_LEVEL_WARNING
pload_exec_message_req_types
@ MESSAGE_REQ_EXEC_PLOAD_MCAST
@ MESSAGE_REQ_EXEC_PLOAD_START
struct corosync_service_engine pload_service_engine
LOGSYS_DECLARE_SUBSYS("PLOAD")
struct corosync_service_engine * pload_get_service_engine_ver0(void)
The corosync_api_v1 struct.
int(* totem_mcast)(const struct iovec *iovec, unsigned int iov_len, unsigned int guarantee)
int(* schedwrk_create)(hdb_handle_t *handle, int(schedwrk_fn)(const void *), const void *context)
The corosync_exec_handler struct.
void(* exec_handler_fn)(const void *msg, unsigned int nodeid)
The corosync_service_engine struct.
Structure passed as new_value and old_value in change callback.
struct qb_ipc_request_header header
struct qb_ipc_request_header header
#define swab32(x)
The swab32 macro.