Skip to content
Snippets Groups Projects
Commit 86196fe5 authored by Dmitriy A. Gerasimov's avatar Dmitriy A. Gerasimov
Browse files

[-] Depricated dap_uint128_t

[*] Replaced some macros for polling
[+] Added more logs
parent 83046b15
No related branches found
No related tags found
2 merge requests!251Master,!250Master
Pipeline #5622 passed with stage
in 11 seconds
......@@ -29,12 +29,3 @@ typedef union int128{int64_t i64[2];} int128_t;
#endif
typedef union dap_uint128{
uint8_t data_raw[16];
#if defined(DAP_GLOBAL_IS_INT128)
_dap_int128_t data_int128;
#endif
} dap_uint128_t;
......@@ -161,11 +161,11 @@ static void * s_proc_thread_function(void * a_arg)
l_thread->proc_event->_inheritor = l_thread; // we pass thread through it
#ifdef DAP_EVENTS_CAPS_EPOLL
struct epoll_event l_epoll_events[DAP_MAX_EPOLL_EVENTS], l_ev;
struct epoll_event l_epoll_events[DAP_EVENTS_SOCKET_MAX], l_ev;
memset(l_epoll_events, 0,sizeof (l_epoll_events));
// Create epoll ctl
l_thread->epoll_ctl = epoll_create( DAP_MAX_EPOLL_EVENTS );
l_thread->epoll_ctl = epoll_create( DAP_EVENTS_SOCKET_MAX );
// add proc queue
l_ev.events = l_thread->proc_queue->esocket->ev_base_flags;
......@@ -183,7 +183,7 @@ static void * s_proc_thread_function(void * a_arg)
return NULL;
}
#elif defined(DAP_EVENTS_CAPS_POLL)
size_t l_poll_count_max = DAP_MAX_EVENTS_COUNT;
size_t l_poll_count_max = DAP_EVENTS_SOCKET_MAX;
size_t l_poll_count = 0;
bool l_poll_compress = false;
struct pollfd * l_poll = DAP_NEW_Z_SIZE(struct pollfd,l_poll_count_max *sizeof (*l_poll));
......@@ -214,7 +214,7 @@ static void * s_proc_thread_function(void * a_arg)
#ifdef DAP_EVENTS_CAPS_EPOLL
//log_it(L_DEBUG, "Epoll_wait call");
int l_selected_sockets = epoll_wait(l_thread->epoll_ctl, l_epoll_events, DAP_MAX_EPOLL_EVENTS, -1);
int l_selected_sockets = epoll_wait(l_thread->epoll_ctl, l_epoll_events, DAP_EVENTS_SOCKET_MAX, -1);
size_t l_sockets_max = l_selected_sockets;
#elif defined (DAP_EVENTS_CAPS_POLL)
int l_selected_sockets = poll(l_poll,l_poll_count,-1);
......
......@@ -85,10 +85,10 @@ void *dap_worker_thread(void *arg)
pthread_setschedparam(pthread_self(),SCHED_FIFO ,&l_shed_params);
#ifdef DAP_EVENTS_CAPS_EPOLL
struct epoll_event l_epoll_events[ DAP_MAX_EPOLL_EVENTS]= {{0}};
struct epoll_event l_epoll_events[ DAP_EVENTS_SOCKET_MAX]= {{0}};
log_it(L_INFO, "Worker #%d started with epoll fd %d and assigned to dedicated CPU unit", l_worker->id, l_worker->epoll_fd);
#elif defined(DAP_EVENTS_CAPS_POLL)
l_worker->poll_count_max = _SC_PAGE_SIZE;
l_worker->poll_count_max = DAP_EVENTS_SOCKET_MAX;
l_worker->poll = DAP_NEW_Z_SIZE(struct pollfd,l_worker->poll_count_max*sizeof (struct pollfd));
l_worker->poll_esocket = DAP_NEW_Z_SIZE(dap_events_socket_t*,l_worker->poll_count_max*sizeof (dap_events_socket_t*));
#else
......@@ -109,7 +109,7 @@ void *dap_worker_thread(void *arg)
bool s_loop_is_active = true;
while(s_loop_is_active) {
#ifdef DAP_EVENTS_CAPS_EPOLL
int l_selected_sockets = epoll_wait(l_worker->epoll_fd, l_epoll_events, DAP_MAX_EPOLL_EVENTS, -1);
int l_selected_sockets = epoll_wait(l_worker->epoll_fd, l_epoll_events, DAP_EVENTS_SOCKET_MAX, -1);
size_t l_sockets_max = l_selected_sockets;
#elif defined(DAP_EVENTS_CAPS_POLL)
int l_selected_sockets = poll(l_worker->poll, l_worker->poll_count, -1);
......@@ -650,8 +650,8 @@ int dap_worker_add_events_socket_unsafe( dap_events_socket_t * a_esocket, dap_wo
return epoll_ctl(a_worker->epoll_fd, EPOLL_CTL_ADD, a_esocket->socket, &a_esocket->ev);
#elif defined (DAP_EVENTS_CAPS_POLL)
if ( a_worker->poll_count == a_worker->poll_count_max ){ // realloc
log_it(L_WARNING, "Too many descriptors, resizing array twice");
a_worker->poll_count_max *= 2;
log_it(L_WARNING, "Too many descriptors (%u), resizing array twice to %u", a_worker->poll_count, a_worker->poll_count_max);
a_worker->poll =DAP_REALLOC(a_worker->poll, a_worker->poll_count_max * sizeof(*a_worker->poll));
a_worker->poll_esocket =DAP_REALLOC(a_worker->poll_esocket, a_worker->poll_count_max * sizeof(*a_worker->poll_esocket));
}
......
......@@ -30,6 +30,7 @@
#include "dap_common.h"
#define DAP_EVENTS_SOCKET_MAX 8194
// Caps for different platforms
#if defined(DAP_OS_LINUX)
// #define DAP_EVENTS_CAPS_EPOLL
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment