89 #define STRESS1_NUM_CONTEXTS 3000 90 #define STRESS2_MAX_NUM_THREADS 64 91 #define STRESS3_MAX_NUM_MESSAGES 512 111 printf(
"Usage: dlt-test-stress [options]\n");
112 printf(
"Test application executing several stress tests.\n");
113 printf(
"%s \n", version);
114 printf(
"Options:\n");
115 printf(
" -v Verbose mode\n");
116 printf(
" -f filename Use local log file instead of sending to daemon\n");
117 printf(
" -1 Execute test 1 (register/unregister many contexts)\n");
118 printf(
" -2 Execute test 2 (multiple threads logging data)\n");
119 printf(
" -3 Execute test 3 (logging much data)\n");
125 int main(
int argc,
char* argv[])
140 while ((c = getopt (argc, argv,
"vf:123")) != -1)
173 fprintf (stderr,
"Option -%c requires an argument.\n", optopt);
175 else if (isprint (optopt))
177 fprintf (stderr,
"Unknown option `-%c'.\n", optopt);
181 fprintf (stderr,
"Unknown option character `\\x%x'.\n",optopt);
247 printf(
"Starting stress test1... (press \"Enter\" to terminate test) \n");
255 snprintf(ctid,5,
"%d",i);
273 printf(
"* Unregister %d contexts...\n",STRESS1_NUM_CONTEXTS);
281 printf(
"Finished stress test1 \n\n");
291 printf(
"Starting stress test2... \n");
296 printf(
" sending one log message, then unregisters the context\n");
300 thread_data[index].
num = index;
301 ret=pthread_create(&(thread[index]),
NULL, (
void *) &
thread_function, (
void *) &(thread_data[index]));
304 printf(
"Error creating thread %d: %s \n", index, strerror(errno));
312 pthread_join(thread[index],
NULL);
315 printf(
"Finished stress test2 \n\n");
329 snprintf(ctid,5,
"%.2x", rand() & 0x0000ffff);
349 printf(
"Starting stress test3... \n");
359 printf(
"Finished stress test3 \n\n");
#define DLT_RAW(BUF, LEN)
#define DLT_UNREGISTER_APP()
void thread_function(void)
int main(int argc, char *argv[])
DltReturnValue dlt_register_context(DltContext *handle, const char *contextid, const char *description)
#define STRESS3_MAX_NUM_MESSAGES
DltReturnValue dlt_init_file(const char *name)
#define DLT_DECLARE_CONTEXT(CONTEXT)
#define DLT_REGISTER_APP(APPID, DESCRIPTION)
unsigned char buffer[BUFFER_SIZE]
Buffer for dlt file transfer. The size is defined by BUFFER_SIZE.
#define DLT_REGISTER_CONTEXT(CONTEXT, CONTEXTID, DESCRIPTION)
#define DLT_UNREGISTER_CONTEXT(CONTEXT)
#define DLT_LOG(CONTEXT, LOGLEVEL, ARGS...)
DltContext mycontext[9999]
#define STRESS2_MAX_NUM_THREADS
void dlt_get_version(char *buf, size_t size)
#define STRESS1_NUM_CONTEXTS