Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve nc file import core function #17

Merged
merged 1 commit into from
Nov 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions etc/oph_ioserver.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ MAX_PACKET_LEN=4000000
CLIENT_TTL=300
OPENMP_THREADS=2
MEMORY_BUFFER=1024
CACHE_LINE_SIZE=64
CACHE_SIZE=262144
5 changes: 4 additions & 1 deletion src/common/oph_server_confs.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,12 @@
#define OPH_SERVER_CONF_TTL "CLIENT_TTL"
#define OPH_SERVER_CONF_OMP_THREADS "OPENMP_THREADS"
#define OPH_SERVER_CONF_MEMORY_BUFFER "MEMORY_BUFFER"
#define OPH_SERVER_CONF_CACHE_LINE_SIZE "CACHE_LINE_SIZE"
#define OPH_SERVER_CONF_CACHE_SIZE "CACHE_SIZE"


static const char *const oph_server_conf_params[] =
{ OPH_SERVER_CONF_HOSTNAME, OPH_SERVER_CONF_PORT, OPH_SERVER_CONF_DIR, OPH_SERVER_CONF_MPL, OPH_SERVER_CONF_TTL, OPH_SERVER_CONF_OMP_THREADS, OPH_SERVER_CONF_MEMORY_BUFFER, NULL };
{ OPH_SERVER_CONF_HOSTNAME, OPH_SERVER_CONF_PORT, OPH_SERVER_CONF_DIR, OPH_SERVER_CONF_MPL, OPH_SERVER_CONF_TTL, OPH_SERVER_CONF_OMP_THREADS, OPH_SERVER_CONF_MEMORY_BUFFER, OPH_SERVER_CONF_CACHE_LINE_SIZE, OPH_SERVER_CONF_CACHE_SIZE, NULL };

/**
* \brief Function to load parameters from configuration file
Expand Down
26 changes: 24 additions & 2 deletions src/server/oph_io_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ unsigned short omp_threads = 0;
unsigned short client_ttl = 0;
unsigned short disable_mem_check = 0;
unsigned long long memory_buffer = 0;
unsigned short cache_line_size = 0;
unsigned short cache_size = 0;

pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER;
pthread_mutex_t libtool_lock = PTHREAD_MUTEX_INITIALIZER;
Expand Down Expand Up @@ -130,6 +132,8 @@ int main(int argc, char *argv[])
char *dir = 0;
char *omp = 0;
char *mem_buf = 0;
char *cache_line = 0;
char *cache = 0;

if (oph_server_conf_get_param(conf_db, OPH_SERVER_CONF_DIR, &dir)) {
pmesg(LOG_WARNING, __FILE__, __LINE__, "Unable to get server dir param\n");
Expand Down Expand Up @@ -175,8 +179,8 @@ int main(int argc, char *argv[])
client_ttl = strtol(ttl, NULL, 10);

if (oph_server_conf_get_param(conf_db, OPH_SERVER_CONF_OMP_THREADS, &omp)) {
pmesg(LOG_ERROR, __FILE__, __LINE__, "Unable to get hostname param\n");
logging(LOG_ERROR, __FILE__, __LINE__, "Unable to get hostname param\n");
pmesg(LOG_ERROR, __FILE__, __LINE__, "Unable to get number of OpenMP threads param\n");
logging(LOG_ERROR, __FILE__, __LINE__, "Unable to get number of OpenMP threads param\n");
oph_server_conf_unload(&conf_db);
return -1;
}
Expand All @@ -192,6 +196,24 @@ int main(int argc, char *argv[])

memory_buffer = strtol(mem_buf, NULL, 10);

if (oph_server_conf_get_param(conf_db, OPH_SERVER_CONF_CACHE_SIZE, &cache)) {
pmesg(LOG_ERROR, __FILE__, __LINE__, "Unable to get cache size buffer param\n");
logging(LOG_ERROR, __FILE__, __LINE__, "Unable to get cache size buffer param\n");
oph_server_conf_unload(&conf_db);
return -1;
}

cache_size = strtol(mem_buf, NULL, 10);

if (oph_server_conf_get_param(conf_db, OPH_SERVER_CONF_CACHE_LINE_SIZE, &cache_line)) {
pmesg(LOG_ERROR, __FILE__, __LINE__, "Unable to get cache line size buffer param\n");
logging(LOG_ERROR, __FILE__, __LINE__, "Unable to get cache line size buffer param\n");
oph_server_conf_unload(&conf_db);
return -1;
}

cache_line_size = strtol(mem_buf, NULL, 10);

if (oph_load_plugins(&plugin_table, &oph_function_table)) {
pmesg(LOG_ERROR, __FILE__, __LINE__, "Unable to load plugin table\n");
logging(LOG_ERROR, __FILE__, __LINE__, "Unable to load plugin table\n");
Expand Down
Loading