3c792ef04f4e97d16c754823f63b3c9835cf9d7d
2 * Copyright (C) 2008 Martin Willi
3 * Hochschule fuer Technik Rapperswil
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26 static void* testing(void *thread
)
30 identification_t
*id
[ALLOCS
];
32 /* prepare identities */
33 for (i
= 0; i
< ALLOCS
; i
++)
37 snprintf(buf
, sizeof(buf
), "%d-%d@strongswan.org", (int)thread
, i
);
38 id
[i
] = identification_create_from_string(buf
);
41 /* allocate addresses */
42 for (i
= 0; i
< ALLOCS
; i
++)
44 addr
[i
] = charon
->attributes
->acquire_address(charon
->attributes
,
52 /* release addresses */
53 for (i
= 0; i
< ALLOCS
; i
++)
55 charon
->attributes
->release_address(charon
->attributes
, "test", addr
[i
], id
[i
]);
59 for (i
= 0; i
< ALLOCS
; i
++)
61 addr
[i
]->destroy(addr
[i
]);
62 id
[i
]->destroy(id
[i
]);
68 /*******************************************************************************
69 * SQL pool performance test
70 ******************************************************************************/
75 pthread_t thread
[THREADS
];
77 for (i
= 0; i
< THREADS
; i
++)
79 if (pthread_create(&thread
[i
], NULL
, (void*)testing
, (void*)i
) < 0)
84 for (i
= 0; i
< THREADS
; i
++)
86 pthread_join(thread
[i
], &res
);