summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2014-05-13 11:09:59 +0200
committerAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2014-05-16 08:37:34 +0200
commit34a670beb01bda0723f8be004b4ab94eb5287753 (patch)
tree1c5400f2786e62b8094c3000ae7408f1cf9c88c5
parent8b48e73f79b4463393916e4c6696917e3dedd026 (diff)
downloadDLT-daemon-34a670beb01bda0723f8be004b4ab94eb5287753.tar.gz
Make daemon buffer size configurable
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
-rw-r--r--src/daemon/dlt-daemon.c17
-rwxr-xr-xsrc/daemon/dlt-daemon.h3
-rw-r--r--src/daemon/dlt.conf9
-rw-r--r--src/daemon/dlt_daemon_common.c6
-rw-r--r--src/daemon/dlt_daemon_common.h5
5 files changed, 36 insertions, 4 deletions
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c
index 5f7d0dd..c8b4703 100644
--- a/src/daemon/dlt-daemon.c
+++ b/src/daemon/dlt-daemon.c
@@ -178,6 +178,9 @@ int option_file_parser(DltDaemonLocal *daemon_local)
strncpy(daemon_local->flags.loggingFilename, DLT_USER_DIR "/dlt.log",sizeof(daemon_local->flags.loggingFilename)-1);
daemon_local->flags.loggingFilename[sizeof(daemon_local->flags.loggingFilename)-1]=0;
daemon_local->timeoutOnSend = 4;
+ daemon_local->RingbufferMinSize = DLT_DAEMON_RINGBUFFER_MIN_SIZE;
+ daemon_local->RingbufferMaxSize = DLT_DAEMON_RINGBUFFER_MAX_SIZE;
+ daemon_local->RingbufferStepSize = DLT_DAEMON_RINGBUFFER_STEP_SIZE;
daemon_local->flags.sendECUSoftwareVersion = 0;
memset(daemon_local->flags.pathToECUSoftwareVersion, 0, sizeof(daemon_local->flags.pathToECUSoftwareVersion));
daemon_local->flags.sendTimezone = 0;
@@ -314,6 +317,18 @@ int option_file_parser(DltDaemonLocal *daemon_local)
daemon_local->timeoutOnSend = atoi(value);
//printf("Option: %s=%s\n",token,value);
}
+ else if(strcmp(token,"RingbufferMinSize")==0)
+ {
+ sscanf(value,"%lu",&(daemon_local->RingbufferMinSize));
+ }
+ else if(strcmp(token,"RingbufferMaxSize")==0)
+ {
+ sscanf(value,"%lu",&(daemon_local->RingbufferMaxSize));
+ }
+ else if(strcmp(token,"RingbufferStepSize")==0)
+ {
+ sscanf(value,"%lu",&(daemon_local->RingbufferStepSize));
+ }
else if(strcmp(token,"SharedMemorySize")==0)
{
daemon_local->flags.sharedMemorySize = atoi(value);
@@ -686,7 +701,7 @@ int dlt_daemon_local_init_p2(DltDaemon *daemon, DltDaemonLocal *daemon_local, in
}
/* Daemon data */
- if (dlt_daemon_init(daemon,daemon_local->flags.ivalue,daemon_local->flags.vflag)==-1)
+ if (dlt_daemon_init(daemon,daemon_local->RingbufferMinSize,daemon_local->RingbufferMaxSize,daemon_local->RingbufferStepSize,daemon_local->flags.ivalue,daemon_local->flags.vflag)==-1)
{
dlt_log(LOG_ERR,"Could not initialize daemon data\n");
return -1;
diff --git a/src/daemon/dlt-daemon.h b/src/daemon/dlt-daemon.h
index 69c679e..dfe4de3 100755
--- a/src/daemon/dlt-daemon.h
+++ b/src/daemon/dlt-daemon.h
@@ -136,6 +136,9 @@ typedef struct
int timer_wd; /** file descriptor for watchdog timer */
#endif
int timeoutOnSend;
+ unsigned long RingbufferMinSize;
+ unsigned long RingbufferMaxSize;
+ unsigned long RingbufferStepSize;
int timer_one_s;
int timer_sixty_s;
} DltDaemonLocal;
diff --git a/src/daemon/dlt.conf b/src/daemon/dlt.conf
index a079d3e..1032a9a 100644
--- a/src/daemon/dlt.conf
+++ b/src/daemon/dlt.conf
@@ -44,6 +44,15 @@ LoggingFilename = /tmp/dlt.log
# Timeout on send to client (sec)
TimeOutOnSend = 4
+# The minimum size of the Ringbuffer, used for storing temporary DLT messages, until client is connected (Default: 500000)
+RingbufferMinSize = 500000
+
+# The max size of the Ringbuffer, used for storing temporary DLT messages, until client is connected (Default: 10000000)
+RingbufferMaxSize = 10000000
+
+# The step size the Ringbuffer is increased, used for storing temporary DLT messages, until client is connected (Default: 500000)
+RingbufferStepSize = 500000
+
########################################################################
# Offline Trace memory #
########################################################################
diff --git a/src/daemon/dlt_daemon_common.c b/src/daemon/dlt_daemon_common.c
index 6e9bf9b..a2392fc 100644
--- a/src/daemon/dlt_daemon_common.c
+++ b/src/daemon/dlt_daemon_common.c
@@ -120,7 +120,7 @@ static int dlt_daemon_cmp_apid_ctid(const void *m1, const void *m2)
return ret;
}
-int dlt_daemon_init(DltDaemon *daemon,const char *runtime_directory, int verbose)
+int dlt_daemon_init(DltDaemon *daemon,unsigned long RingbufferMinSize,unsigned long RingbufferMaxSize,unsigned long RingbufferStepSize,const char *runtime_directory, int verbose)
{
PRINT_FUNCTION_VERBOSE(verbose);
@@ -206,7 +206,9 @@ int dlt_daemon_init(DltDaemon *daemon,const char *runtime_directory, int verbose
dlt_set_id(daemon->ecuid,"");
/* initialize ring buffer for client connection */
- if (dlt_buffer_init_dynamic(&(daemon->client_ringbuffer), DLT_DAEMON_RINGBUFFER_MIN_SIZE,DLT_DAEMON_RINGBUFFER_MAX_SIZE,DLT_DAEMON_RINGBUFFER_STEP_SIZE)==-1)
+ snprintf(str,DLT_DAEMON_COMMON_TEXTBUFSIZE,"Ringbuffer configuration: %lu/%lu/%lu\n", RingbufferMinSize,RingbufferMaxSize,RingbufferStepSize );
+ dlt_log(LOG_INFO, str);
+ if (dlt_buffer_init_dynamic(&(daemon->client_ringbuffer), RingbufferMinSize,RingbufferMaxSize,RingbufferStepSize)==-1)
{
return -1;
}
diff --git a/src/daemon/dlt_daemon_common.h b/src/daemon/dlt_daemon_common.h
index 4c92c43..db1bc0b 100644
--- a/src/daemon/dlt_daemon_common.h
+++ b/src/daemon/dlt_daemon_common.h
@@ -163,11 +163,14 @@ typedef struct
* Initialise the dlt daemon structure
* This function must be called before using further dlt daemon structure
* @param daemon pointer to dlt daemon structure
+ * @param RingbufferMinSize ringbuffer size
+ * @param RingbufferMaxSize ringbuffer size
+ * @param RingbufferStepSize ringbuffer size
* @param runtime_directory Directory of persistent configuration
* @param verbose if set to true verbose information is printed out.
* @return negative value if there was an error
*/
-int dlt_daemon_init(DltDaemon *daemon,const char *runtime_directory,int verbose);
+int dlt_daemon_init(DltDaemon *daemon,unsigned long RingbufferMinSize,unsigned long RingbufferMaxSize,unsigned long RingbufferStepSize,const char *runtime_directory,int verbose);
/**
* De-Initialise the dlt daemon structure
* @param daemon pointer to dlt daemon structure