X-Git-Url: https://git.strongswan.org/?p=strongswan.git;a=blobdiff_plain;f=scripts%2Fthread_analysis.c;h=7670ce1f808e07c17d288c7de609cf7cab58d6c3;hp=53cd043590e7ffb6d534a4a4639ae06e83ba40f2;hb=8ab900dee9b6731144b2e05ac05f942cf79a9039;hpb=b768170bf38bab949b17c4c02867f2bd9c515653
diff --git a/scripts/thread_analysis.c b/scripts/thread_analysis.c
index 53cd043..7670ce1 100644
--- a/scripts/thread_analysis.c
+++ b/scripts/thread_analysis.c
@@ -1,5 +1,5 @@
/* Analyzes the concurrent use of charon's threads
- *
+ *
* Copyright (C) 2008 Andreas Steffen
* Hochschule fuer Technik Rapperswil
*
@@ -52,7 +52,7 @@ static int readline(FILE *fd, char *line)
*line = '\0';
return 1;
}
- line++;
+ line++;
}
*line = '\0';
return 0;
@@ -69,14 +69,14 @@ static void printline(state_t *state, char *timestamp)
for (th = 1; th <= THREADS; th++)
{
states[state[th]]++;
- printf("
| ", state_names[state[th]]);
+ printf(" | ", state_names[state[th]]);
}
total = states[STATE_INIT] + states[STATE_AUTH] + states[STATE_BUSY] + states[STATE_RETRY];
printf("%d | %d | %d | ",
states[STATE_INIT], states[STATE_AUTH], total);
for (th = 10; th <= (THREADS + 2); th += 5)
{
- printf(" | ", (th <= total + 2)? "busy":"idle");
+ printf(" | ", (th <= total + 2)? "busy":"idle");
}
printf("\n");
printf(" \n");
@@ -91,13 +91,13 @@ int main(int argc, char *argv[])
FILE *fd;
state_t state[THREADS + 1];
-
+
/* threads 1..5 and 9 are always busy */
for (th = 1; th <= THREADS; th++)
{
state[th] = (th <= 7 && th != 3)? STATE_BUSY : STATE_IDLE;
}
-
+
/* open the log file */
fd = fopen(LOGFILE, "r");
if (!fd)
@@ -135,16 +135,16 @@ int main(int argc, char *argv[])
printf(" Timestamp | ");
for (th = 1 ; th <= THREADS; th++)
{
- printf("%02d | ", th);
+ printf("%02d | ", th);
}
printf("I | A | B | ");
for (th = 10; th <= (THREADS + 2); th += 5)
{
- printf("%d | ", (th == 100)? 99:th);
+ printf("%d | ", (th == 100)? 99:th);
}
printf("\n");
printf(" \n");
-
+
while (readline(fd, line))
{
char *p_section, *p_charon, *p_thread, *p_log;
@@ -170,7 +170,7 @@ int main(int argc, char *argv[])
{
continue;
}
-
+
/* determine thread */
p_thread = p_charon + 8;
th = atol(p_thread);
@@ -268,6 +268,6 @@ int main(int argc, char *argv[])
printf("