/* * Dlt Client test utilities - Diagnostic Log and Trace * @licence app begin@ * * Copyright (C) 2011, BMW AG - Alexander Wenzel * * This program is free software; you can redistribute it and/or modify it under the terms of the * GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation. * 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 Lesser General * Public License, version 2.1, for more details. * * You should have received a copy of the GNU Lesser General Public License, version 2.1, along * with this program; if not, see . * * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may * also be applicable to programs even in cases in which the program is not a library in the technical sense. * * Linking DLT statically or dynamically with other modules is making a combined work based on DLT. You may * license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to * license your linked modules under the GNU Lesser General Public License, version 2.1, you * may use the program under the following exception. * * As a special exception, the copyright holders of DLT give you permission to combine DLT * with software programs or libraries that are released under any license unless such a combination is not * permitted by the license of such a software program or library. You may copy and distribute such a * system following the terms of the GNU Lesser General Public License, version 2.1, including this * special exception, for DLT and the licenses of the other code concerned. * * Note that people who make modified versions of DLT are not obligated to grant this special exception * for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, * version 2.1, gives permission to release a modified version without this exception; this exception * also makes it possible to release a modified version which carries forward this exception. * * @licence end@ */ /******************************************************************************* ** ** ** SRC-MODULE: dlt-test-stress.c ** ** ** ** TARGET : linux ** ** ** ** PROJECT : DLT ** ** ** ** AUTHOR : Alexander Wenzel Alexander.AW.Wenzel@bmw.de ** ** Markus Klein ** ** ** ** PURPOSE : ** ** ** ** REMARKS : ** ** ** ** PLATFORM DEPENDANT [yes/no]: yes ** ** ** ** TO BE CHANGED BY USER [yes/no]: no ** ** ** *******************************************************************************/ /******************************************************************************* ** Author Identity ** ******************************************************************************** ** ** ** Initials Name Company ** ** -------- ------------------------- ---------------------------------- ** ** aw Alexander Wenzel BMW ** ** mk Markus Klein Fraunhofer ESK ** *******************************************************************************/ /******************************************************************************* ** Revision Control History ** *******************************************************************************/ /* * $LastChangedRevision: 1670 $ * $LastChangedDate: 2011-04-08 15:12:06 +0200 (Fr, 08. Apr 2011) $ * $LastChangedBy$ Initials Date Comment aw 13.01.2010 initial */ #include #include /* for isprint() */ #include #include /* for printf() and fprintf() */ #include /* for atoi() and exit() */ #include /* for memset() */ #include /* for close() */ #include /* POSIX Threads */ #include "dlt.h" #include "dlt_common.h" /* for dlt_get_version() */ DltContext mycontext[9999]; typedef struct { int num; } thread_data_t; #define STRESS1_NUM_CONTEXTS 3000 #define STRESS2_MAX_NUM_THREADS 256 #define STRESS3_MAX_NUM_MESSAGES 512 #define MAX_TESTS 3 void stress1(void); void stress2(void); void thread_function(void *ptr); void stress3(void); /** * Print usage information of tool. */ void usage() { char version[255]; dlt_get_version(version); printf("Usage: dlt-test-stress [options]\n"); printf("Test application executing several stress tests.\n"); printf("%s \n", version); printf("Options:\n"); printf(" -v Verbose mode\n"); printf(" -f filename Use local log file instead of sending to daemon\n"); printf(" -1 Execute test 1 (register/unregister many contexts)\n"); printf(" -2 Execute test 2 (multiple threads logging data)\n"); printf(" -3 Execute test 3 (logging much data)\n"); } /** * Main function of tool. */ int main(int argc, char* argv[]) { int vflag = 0; char *fvalue = 0; int test[MAX_TESTS]; int i,c,help; for (i=0;i