Hi,
I have improved the patch mentioned below adding option -trace_dir for
determining where the automatic/implist log/trace files go.
Sipp.cpp does chdir to trace_dir, and the code strips the scenario-file
directory from the path.
I have also fixed up support for [auto_media_port], including a more
tight rotation of media_ports within a range.
Where should I direct patches - to get them considered ?
cheers
Olav
Olav Kvittem skrev:
> nedo nodo skrev:
>> Hi,
>>
>> I'm a newbie of SIPp. I would like to know how can I set the name of
>> -trace_msg and -trace_err?
>>
>> sipp -m 1 -d 36000000 -bg -s 1000 -sn uac 192.168.0.5 -trace_err -trace_msg
>
> It looks like that all reportfiles are written to the directory of the
> xml-file.
> I have modified the code to write into current directory.
> A parameter designating the report_dir would be nicer.
> You will find the patch a couple of years back in the list archives or
> contact me.
>
> Olav
>> Thank
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------------
>> The Planet: dedicated and managed hosting, cloud storage, colocation
>> Stay online with enterprise data centers and the best network in the business
>> Choose flexible plans and management services without long-term contracts
>> Personal 24x7 support from experience hosting pros just a phone call away.
>> http://p.sf.net/sfu/theplanet-com
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Sipp-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/sipp-users
>
>
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Sipp-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sipp-users
>
Index: call.cpp
===================================================================
--- call.cpp (revision 590)
+++ call.cpp (working copy)
@@ -201,7 +201,7 @@
/* m=audio not found */
return 0;
}
- begin += strlen(pattern) - 1;
+ begin += strlen(pattern) ;
end = strstr(begin, "\r\n");
if (!end)
ERROR("get_remote_port_media: no CRLF found");
@@ -2152,11 +2152,14 @@
dest += snprintf(dest, left, "%s", media_ip_escaped);
break;
case E_Message_Media_Port:
+ dest += sprintf(dest, "%u", media_port + comp->offset);
+ break;
case E_Message_Auto_Media_Port: {
- int port = media_port + comp->offset;
if (comp->type == E_Message_Auto_Media_Port) {
- port = media_port + (4 * (number - 1)) % 10000 + comp->offset;
+ // port=media_port += (4 * (number - 1)) % 10000;
+ media_port = (media_port + 4) % 1000;
}
+ int port = media_port + comp->offset;
#ifdef PCAPPLAY
char *begin = dest;
while (begin > msg_buffer) {
Index: sipp.hpp
===================================================================
--- sipp.hpp (revision 590)
+++ sipp.hpp (working copy)
@@ -460,6 +460,8 @@
extern bool dumpInRtt _DEFVAL(0);
extern bool useCountf _DEFVAL(0);
extern char * scenario_file;
+extern char * trace_base; // basename for log files
+extern char * trace_dir; // option dir for log files
extern char * slave_cfg_file;
extern unsigned long long max_log_size _DEFVAL(0);
Index: sipp.cpp
===================================================================
--- sipp.cpp (revision 590)
+++ sipp.cpp (working copy)
@@ -314,6 +314,7 @@
{"trace_counts", "Dumps individual message counts in a CSV file.", SIPP_OPTION_SETFLAG, &useCountf, 1},
{"trace_rtt", "Allow tracing of all response times in <scenario file name>_<pid>_rtt.csv.", SIPP_OPTION_SETFLAG, &dumpInRtt, 1},
{"trace_logs", "Allow tracing of <log> actions in <scenario file name>_<pid>_logs.log.", SIPP_OPTION_SETFLAG, &useLogf, 1},
+ {"trace_dir", "Define directory to put trace files (default working directory)",SIPP_OPTION_STRING, &trace_dir, 1},
{"users", "Instead of starting calls at a fixed rate, begin 'users' calls at startup, and keep the number of calls constant.", SIPP_OPTION_USERS, NULL, 1},
@@ -3297,7 +3298,7 @@
{
/* create the file */
char L_file_name [MAX_PATH];
- sprintf (L_file_name, "%s_%d_screen.log", scenario_file, getpid());
+ sprintf (L_file_name, "%s_%d_screen.log", trace_base, getpid());
getmilliseconds();
@@ -4470,18 +4471,22 @@
scenario_file = new char [strlen(argv[argi])+1] ;
sprintf(scenario_file,"%s", argv[argi]);
scenario_file = remove_pattern (scenario_file, (char*)".xml");
+ trace_base=basename((char*)scenario_file);
+ /*OK open log after trace_dir is set
if (useLogf == 1) {
rotate_logfile();
- }
+ }
+ */
main_scenario = new scenario(argv[argi], 0);
- main_scenario->stats->setFileName(scenario_file, (char*)".csv");
+ main_scenario->stats->setFileName(trace_base, (char*)".csv");
} else if (!strcmp(argv[argi - 1], "-sn")) {
int i = find_scenario(argv[argi]);
main_scenario = new scenario(0, i);
scenario_file = new char [strlen(argv[argi])+1] ;
sprintf(scenario_file,"%s", argv[argi]);
- main_scenario->stats->setFileName(argv[argi], (char*)".csv");
+ trace_base=basename((char*)scenario_file);
+ main_scenario->stats->setFileName(trace_base, (char*)".csv");
} else if (!strcmp(argv[argi - 1], "-sd")) {
int i = find_scenario(argv[argi]);
fprintf(stdout, "%s", default_scenario[i]);
@@ -4719,11 +4724,18 @@
}
/* trace file setting */
+ chdir(trace_dir);
if (scenario_file == NULL) {
- scenario_file = new char [ 5 ] ;
- sprintf(scenario_file, "%s", "sipp");
+ trace_base = "sipp";
+ } else {
+ trace_base = basename((char*)scenario_file);
}
+ // open log after trace_dir is set
+ if (useLogf == 1) {
+ rotate_logfile();
+ }
+
screen_init(print_last_stats);
#ifdef _USE_OPENSSL
@@ -4747,7 +4759,7 @@
if (useScreenf == 1) {
char L_file_name [MAX_PATH];
- sprintf (L_file_name, "%s_%d_screen.log", scenario_file, getpid());
+ sprintf (L_file_name, "%s_%d_screen.log", trace_base, getpid());
screenf = fopen(L_file_name, "w");
if(!screenf) {
ERROR("Unable to create '%s'", L_file_name);
@@ -4758,7 +4770,7 @@
/* if (useTimeoutf == 1) {
char L_file_name [MAX_PATH];
- sprintf (L_file_name, "%s_%d_timeout.log", scenario_file, getpid());
+ sprintf (L_file_name, "%s_%d_timeout.log", trace_base, getpid());
timeoutf = fopen(L_file_name, "w");
if(!timeoutf) {
ERROR("Unable to create '%s'", L_file_name);
@@ -4767,7 +4779,7 @@
if (useCountf == 1) {
char L_file_name [MAX_PATH];
- sprintf (L_file_name, "%s_%d_counts.csv", scenario_file, getpid());
+ sprintf (L_file_name, "%s_%d_counts.csv", trace_base, getpid());
countf = fopen(L_file_name, "w");
if(!countf) {
ERROR("Unable to create '%s'", L_file_name);
@@ -4776,7 +4788,7 @@
}
if (dumpInRtt == 1) {
- main_scenario->stats->initRtt((char*)scenario_file, (char*)".csv",
+ main_scenario->stats->initRtt((char*)trace_base, (char*)".csv",
report_freq_dumpRtt);
}
@@ -4823,7 +4835,7 @@
if(!main_scenario) {
main_scenario = new scenario(0, 0);
main_scenario->stats->setFileName((char*)"uac", (char*)".csv");
- sprintf(scenario_file,"uac");
+ trace_base="uac";
}
if(!ooc_scenario) {
ooc_scenario = new scenario(0, find_scenario("ooc_default"));
@@ -5685,7 +5697,7 @@
char L_rotate_file_name [MAX_PATH];
if (!lfi->fixedname) {
- sprintf (lfi->file_name, "%s_%d_%s.log", scenario_file, getpid(), lfi->name);
+ sprintf (lfi->file_name, "%s_%d_%s.log", trace_base, getpid(), lfi->name);
}
if (ringbuffer_files > 0) {
@@ -5695,9 +5707,9 @@
/* We need to rotate away an existing file. */
if (lfi->nfiles == ringbuffer_files) {
if ((lfi->ftimes)[0].n) {
- sprintf(L_rotate_file_name, "%s_%d_%s_%lu.%d.log", scenario_file, getpid(), lfi->name, (lfi->ftimes)[0].start, (lfi->ftimes)[0].n);
+ sprintf(L_rotate_file_name, "%s_%d_%s_%lu.%d.log", trace_base, getpid(), lfi->name, (lfi->ftimes)[0].start, (lfi->ftimes)[0].n);
} else {
- sprintf(L_rotate_file_name, "%s_%d_%s_%lu.log", scenario_file, getpid(), lfi->name, (lfi->ftimes)[0].start);
+ sprintf(L_rotate_file_name, "%s_%d_%s_%lu.log", trace_base, getpid(), lfi->name, (lfi->ftimes)[0].start);
}
unlink(L_rotate_file_name);
lfi->nfiles--;
@@ -5711,9 +5723,9 @@
(lfi->ftimes)[lfi->nfiles].n = (lfi->ftimes)[lfi->nfiles - 1].n + 1;
}
if ((lfi->ftimes)[lfi->nfiles].n) {
- sprintf(L_rotate_file_name, "%s_%d_%s_%lu.%d.log", scenario_file, getpid(), lfi->name, (lfi->ftimes)[lfi->nfiles].start, (lfi->ftimes)[lfi->nfiles].n);
+ sprintf(L_rotate_file_name, "%s_%d_%s_%lu.%d.log", trace_base, getpid(), lfi->name, (lfi->ftimes)[lfi->nfiles].start, (lfi->ftimes)[lfi->nfiles].n);
} else {
- sprintf(L_rotate_file_name, "%s_%d_%s_%lu.log", scenario_file, getpid(), lfi->name, (lfi->ftimes)[lfi->nfiles].start);
+ sprintf(L_rotate_file_name, "%s_%d_%s_%lu.log", trace_base, getpid(), lfi->name, (lfi->ftimes)[lfi->nfiles].start);
}
lfi->nfiles++;
fflush(lfi->fptr);
Index: screen.cpp
===================================================================
--- screen.cpp (revision 590)
+++ screen.cpp (working copy)
@@ -159,7 +159,7 @@
managing = 1;
- sprintf (L_file_name, "%s_%d_traces_oversized.log", scenario_file, getpid());
+ sprintf (L_file_name, "%s_%d_traces_oversized.log", trace_base, getpid());
f = fopen(L_file_name, "w");
if(!f) ERROR_NO("Unable to open special error file\n");
GET_TIME (¤tTime);
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Sipp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sipp-users