NewMadeleine

Documentation

nm_bench_req_monitor.c
/*
* NewMadeleine
* Copyright (C) 2016-2024 (see AUTHORS file)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*/
static const nm_tag_t data_tag = 0x01;
static void req_monitor_completion_signal(nm_sr_event_t event, const nm_sr_event_info_t*event_info, void*_ref)
{
nm_cond_status_t*p_cond = _ref;
}
static void req_monitor_bench_server(void*buf, nm_len_t len)
{
nm_sr_request_t sreq, rreq;
nm_cond_init(&cond, 0);
nm_sr_request_set_ref(&rreq, &cond);
nm_sr_request_monitor(nm_bench_common.p_session, &rreq, NM_SR_EVENT_FINALIZED, &req_monitor_completion_signal);
nm_cond_wait(&cond, NM_STATUS_FINALIZED, nm_core_get_singleton());
}
static void req_monitor_bench_client(void*buf, nm_len_t len)
{
nm_sr_request_t sreq, rreq;
nm_cond_init(&cond, 0);
nm_sr_request_set_ref(&rreq, &cond);
nm_sr_request_monitor(nm_bench_common.p_session, &rreq, NM_SR_EVENT_FINALIZED, &req_monitor_completion_signal);
nm_cond_wait(&cond, NM_STATUS_FINALIZED, nm_core_get_singleton());
}
const struct nm_bench_s nm_bench =
{
.name = "req monitor",
.server = &req_monitor_bench_server,
.client = &req_monitor_bench_client
};
nm_status_t nm_cond_status_t
status with synchronization (wait/signal)
#define NM_STATUS_FINALIZED
request is finalized, may be freed
static void nm_cond_init(nm_cond_status_t *p_cond, nm_status_t bitmask)
initialize a nm_cond_status_t object
static void nm_cond_signal(nm_cond_status_t *p_cond, nm_status_t bitmask)
add a bit and wake up threads waiting for it
static void nm_cond_wait(nm_cond_status_t *p_cond, nm_status_t bitmask, nm_core_t p_core)
wait for the given bit to be set in the status; do active polling while waiting
int nm_sr_request_monitor(nm_session_t p_session, nm_sr_request_t *p_request, nm_sr_event_t mask, nm_sr_event_notifier_t notifier)
Set a notification function called upon request completion.
nm_sr_event_t
events for nm_sr_monitor()
static int nm_sr_request_set_ref(nm_sr_request_t *p_request, void *ref)
Add a user reference to a request.
@ NM_SR_EVENT_FINALIZED
request finalized, may be freed by user
struct nm_bench_common_s nm_bench_common
static const nm_tag_t data_tag
uint16_t len
chunk len
Definition: nm_headers.h:0
static int nm_sr_swait(nm_session_t p_session, nm_sr_request_t *p_request)
Wait for the completion of a non blocking send request.
static int nm_sr_irecv(nm_session_t p_session, nm_gate_t p_gate, nm_tag_t tag, void *data, nm_len_t len, nm_sr_request_t *p_request)
Post a non blocking receive request.
static int nm_sr_isend(nm_session_t p_session, nm_gate_t p_gate, nm_tag_t tag, const void *data, nm_len_t len, nm_sr_request_t *p_request)
Post a non blocking send request.
uint64_t nm_tag_t
user tags, 64 bits, contained in indirect hashtable
Definition: nm_types.h:58
uint64_t nm_len_t
data length used by nmad
Definition: nm_types.h:70
nm_session_t p_session
const char * name
internal defintion of the sendrecv request
information field for sendrecv events