socsvn commit: r240556 - in soc2012/gmiller/locking-head: . include
lib/libthr/thread lib/libwitness
tools/regression/lib/libthr/lockprof tools/regression/lib/libwitness
gmiller at FreeBSD.org
gmiller at FreeBSD.org
Mon Aug 20 08:37:54 UTC 2012
Author: gmiller
Date: Mon Aug 20 08:37:51 2012
New Revision: 240556
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240556
Log:
r240634 at FreeBSD-dev: root | 2012-08-18 00:23:09 -0500
Adjust some names for clarity and consistency and fix style(9) issues in the
test suites.
Modified:
soc2012/gmiller/locking-head/ (props changed)
soc2012/gmiller/locking-head/include/pthread_np.h
soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c
soc2012/gmiller/locking-head/lib/libwitness/api.c
soc2012/gmiller/locking-head/lib/libwitness/xml.c
soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/check.c
soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/check.h
soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/conflict.c
soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/lock-cycle.c
soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/recurse.c
soc2012/gmiller/locking-head/tools/regression/lib/libwitness/bless.c
soc2012/gmiller/locking-head/tools/regression/lib/libwitness/check.c
soc2012/gmiller/locking-head/tools/regression/lib/libwitness/check.h
soc2012/gmiller/locking-head/tools/regression/lib/libwitness/graph.c
soc2012/gmiller/locking-head/tools/regression/lib/libwitness/lor-basic.c
soc2012/gmiller/locking-head/tools/regression/lib/libwitness/setname.c
soc2012/gmiller/locking-head/tools/regression/lib/libwitness/setorder.c
soc2012/gmiller/locking-head/tools/regression/lib/libwitness/shared.c
Modified: soc2012/gmiller/locking-head/include/pthread_np.h
==============================================================================
--- soc2012/gmiller/locking-head/include/pthread_np.h Mon Aug 20 06:11:04 2012 (r240555)
+++ soc2012/gmiller/locking-head/include/pthread_np.h Mon Aug 20 08:37:51 2012 (r240556)
@@ -51,8 +51,8 @@
struct timespec wait_max;
struct timespec hold_max;
uintmax_t contest_count;
- struct timespec wait_time;
- struct timespec hold_time;
+ struct timespec wait_total;
+ struct timespec hold_total;
int acq_count;
};
@@ -62,9 +62,9 @@
struct pthread_lor_np {
struct _pthread_lor_private *_pvt;
- char *name_first;
+ char *first_name;
char *first_trace;
- char *name_second;
+ char *second_name;
char *second_trace;
};
Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c
==============================================================================
--- soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c Mon Aug 20 06:11:04 2012 (r240555)
+++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c Mon Aug 20 08:37:51 2012 (r240556)
@@ -48,8 +48,8 @@
struct timespec wait_max;
struct timespec hold_max;
uintmax_t contest_count;
- struct timespec wait_time;
- struct timespec hold_time;
+ struct timespec wait_total;
+ struct timespec hold_total;
int acq_count;
};
@@ -157,8 +157,8 @@
write_element_timespec("wait_max", &stats.wait_max);
write_element_timespec("hold_max", &stats.hold_max);
write_element_numeric("contest_count", stats.contest_count);
- write_element_timespec("wait_time", &stats.wait_time);
- write_element_timespec("hold_time", &stats.hold_time);
+ write_element_timespec("wait_total", &stats.wait_total);
+ write_element_timespec("hold_total", &stats.hold_total);
write_element_numeric("acq_count", stats.acq_count);
}
pthread_statistics_end_np(&stats);
@@ -333,10 +333,11 @@
&acq->wait_time,
sizeof(struct timespec));
}
- TIMESPEC_ADD(&acq_point->hold_time,
- &acq_point->hold_time, &hold_time);
- TIMESPEC_ADD(&acq_point->wait_time,
- &acq_point->wait_time, &acq->wait_time);
+ TIMESPEC_ADD(&acq_point->hold_total,
+ &acq_point->hold_total,
+ &hold_time);
+ TIMESPEC_ADD(&acq_point->wait_total,
+ &acq_point->wait_total, &acq->wait_time);
acq_point->acq_count += acq->count;
if (acq->wait_time.tv_sec != 0 ||
acq->wait_time.tv_nsec != 0) {
@@ -394,8 +395,8 @@
stats->wait_max = stats->_pvt->last_record->wait_max;
stats->hold_max = stats->_pvt->last_record->hold_max;
stats->contest_count = stats->_pvt->last_record->contest_count;
- stats->wait_time = stats->_pvt->last_record->wait_time;
- stats->hold_time = stats->_pvt->last_record->hold_time;
+ stats->wait_total = stats->_pvt->last_record->wait_total;
+ stats->hold_total = stats->_pvt->last_record->hold_total;
stats->acq_count = stats->_pvt->last_record->acq_count;
}
Modified: soc2012/gmiller/locking-head/lib/libwitness/api.c
==============================================================================
--- soc2012/gmiller/locking-head/lib/libwitness/api.c Mon Aug 20 06:11:04 2012 (r240555)
+++ soc2012/gmiller/locking-head/lib/libwitness/api.c Mon Aug 20 08:37:51 2012 (r240556)
@@ -544,9 +544,9 @@
{
int ret;
- lor->name_first = NULL;
+ lor->first_name = NULL;
lor->first_trace = NULL;
- lor->name_second = NULL;
+ lor->second_name = NULL;
lor->second_trace = NULL;
enter_witness();
@@ -580,11 +580,11 @@
ret = 0;
if (lor->_pvt->last_record != NULL) {
- lor->name_first =
+ lor->first_name =
strdup(get_lock_name(lor->_pvt->last_record->lock_first));
lor->first_trace =
strdup(lor->_pvt->last_record->first_trace);
- lor->name_second =
+ lor->second_name =
strdup(get_lock_name(lor->_pvt->last_record->lock_second));
lor->second_trace =
strdup(lor->_pvt->last_record->second_trace);
@@ -605,12 +605,12 @@
lor->_pvt = NULL;
}
- if (lor->name_first != NULL) {
- free(lor->name_first);
+ if (lor->first_name != NULL) {
+ free(lor->first_name);
}
- if (lor->name_second != NULL) {
- free(lor->name_second);
+ if (lor->second_name != NULL) {
+ free(lor->second_name);
}
if (lor->first_trace != NULL) {
Modified: soc2012/gmiller/locking-head/lib/libwitness/xml.c
==============================================================================
--- soc2012/gmiller/locking-head/lib/libwitness/xml.c Mon Aug 20 06:11:04 2012 (r240555)
+++ soc2012/gmiller/locking-head/lib/libwitness/xml.c Mon Aug 20 08:37:51 2012 (r240556)
@@ -90,12 +90,12 @@
open_element("lor");
open_element("first");
- write_element_string("name", lor.name_first);
+ write_element_string("name", lor.first_name);
write_element_block("backtrace", lor.first_trace);
close_element("first");
open_element("second");
- write_element_string("name", lor.name_second);
+ write_element_string("name", lor.second_name);
write_element_block("backtrace", lor.second_trace);
close_element("second");
Modified: soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/check.c
==============================================================================
--- soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/check.c Mon Aug 20 06:11:04 2012 (r240555)
+++ soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/check.c Mon Aug 20 08:37:51 2012 (r240556)
@@ -27,7 +27,7 @@
#include <stdio.h>
-#define MAX_TESTS (100)
+#define MAX_TESTS 100
int success_count = 0;
int fail_count = 0;
@@ -48,7 +48,7 @@
void
show_test_results(void)
{
- int i;
+ int i;
printf("1..%d\n", success_count + fail_count);
Modified: soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/check.h
==============================================================================
--- soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/check.h Mon Aug 20 06:11:04 2012 (r240555)
+++ soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/check.h Mon Aug 20 08:37:51 2012 (r240556)
@@ -25,5 +25,5 @@
*
*/
-void check(char cond);
-void show_test_results(void);
+void check(char cond);
+void show_test_results(void);
Modified: soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/conflict.c
==============================================================================
--- soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/conflict.c Mon Aug 20 06:11:04 2012 (r240555)
+++ soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/conflict.c Mon Aug 20 08:37:51 2012 (r240556)
@@ -44,7 +44,7 @@
pthread_mutex_unlock(&mutex);
- return NULL;
+ return (NULL);
}
void
@@ -65,10 +65,11 @@
void
check_stats_conflict(void)
{
- int record_count = 0;
struct pthread_statistics_np stats;
- long tm;
+ int record_count;
+ long tm;
+ record_count = 0;
pthread_statistics_begin_np(&stats);
while (pthread_statistics_next_np(&stats)) {
record_count++;
@@ -79,8 +80,8 @@
check(stats.contest_count == 1);
- tm = stats.wait_time.tv_sec * 1000000L +
- stats.wait_time.tv_nsec / 1000;
+ tm = stats.wait_total.tv_sec * 1000000L +
+ stats.wait_total.tv_nsec / 1000;
check(tm > 0);
tm = stats.wait_max.tv_sec * 1000000L + stats.wait_max.tv_nsec / 1000;
@@ -95,5 +96,5 @@
show_test_results();
- return 0;
+ return (0);
}
Modified: soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/lock-cycle.c
==============================================================================
--- soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/lock-cycle.c Mon Aug 20 06:11:04 2012 (r240555)
+++ soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/lock-cycle.c Mon Aug 20 08:37:51 2012 (r240556)
@@ -37,7 +37,7 @@
void
lock_cycle(void)
{
- int i;
+ int i;
for (i = 0; i < 1000; i++) {
pthread_mutex_lock(&mutex);
@@ -55,14 +55,14 @@
lock_cycle();
- return NULL;
+ return (NULL);
}
void
multi_cycle()
{
- pthread_t thread1;
- pthread_t thread2;
+ pthread_t thread1;
+ pthread_t thread2;
pthread_create(&thread1, NULL, thread_func, NULL);
pthread_create(&thread2, NULL, thread_func, NULL);
@@ -82,10 +82,11 @@
void
check_stats_single(void)
{
- int record_count = 0;
+ int record_count;
struct pthread_statistics_np stats;
- long tm;
+ long tm;
+ record_count = 0;
pthread_statistics_begin_np(&stats);
while (pthread_statistics_next_np(&stats)) {
record_count++;
@@ -104,10 +105,10 @@
check(stats.contest_count == 0);
- check(stats.wait_time.tv_sec == 0 && stats.wait_time.tv_nsec == 0);
+ check(stats.wait_total.tv_sec == 0 && stats.wait_total.tv_nsec == 0);
- tm = stats.hold_time.tv_sec * 1000000L +
- stats.hold_time.tv_nsec / 1000;
+ tm = stats.hold_total.tv_sec * 1000000L +
+ stats.hold_total.tv_nsec / 1000;
check(tm >= 10000);
check(stats.acq_count == 1000);
@@ -116,10 +117,11 @@
void
check_stats_multi(void)
{
- int record_count = 0;
+ int record_count;
struct pthread_statistics_np stats;
- long tm;
+ long tm;
+ record_count = 0;
pthread_statistics_begin_np(&stats);
while (pthread_statistics_next_np(&stats)) {
record_count++;
@@ -134,8 +136,8 @@
tm = stats.hold_max.tv_sec * 1000000L + stats.hold_max.tv_nsec / 1000;
check(tm >= 30);
- tm = stats.hold_time.tv_sec * 1000000L +
- stats.hold_time.tv_nsec / 1000;
+ tm = stats.hold_total.tv_sec * 1000000L +
+ stats.hold_total.tv_nsec / 1000;
check(tm >= 30000);
check(stats.acq_count == 3000);
@@ -144,9 +146,10 @@
void
check_stats_reset(void)
{
- int record_count = 0;
+ int record_count;
struct pthread_statistics_np stats;
+ record_count = 0;
pthread_statistics_begin_np(&stats);
while (pthread_statistics_next_np(&stats)) {
record_count++;
@@ -170,5 +173,5 @@
show_test_results();
- return 0;
+ return (0);
}
Modified: soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/recurse.c
==============================================================================
--- soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/recurse.c Mon Aug 20 06:11:04 2012 (r240555)
+++ soc2012/gmiller/locking-head/tools/regression/lib/libthr/lockprof/recurse.c Mon Aug 20 08:37:51 2012 (r240556)
@@ -55,10 +55,11 @@
void
check_stats_recursion(void)
{
- int record_count = 0;
+ int record_count;
struct pthread_statistics_np stats;
- long tm;
+ long tm;
+ record_count = 0;
pthread_statistics_begin_np(&stats);
while (pthread_statistics_next_np(&stats)) {
record_count++;
@@ -73,15 +74,15 @@
check(stats.contest_count == 0);
- check(stats.wait_time.tv_sec == 0 && stats.wait_time.tv_nsec == 0);
+ check(stats.wait_total.tv_sec == 0 && stats.wait_total.tv_nsec == 0);
check(stats.acq_count == 1);
tm = stats.hold_max.tv_sec * 1000000L + stats.hold_max.tv_nsec / 1000;
check(tm >= 1000000);
- tm = stats.hold_time.tv_sec * 1000000L +
- stats.hold_time.tv_nsec / 1000;
+ tm = stats.hold_total.tv_sec * 1000000L +
+ stats.hold_total.tv_nsec / 1000;
check(tm >= 1000000);
}
@@ -93,5 +94,5 @@
show_test_results();
- return 0;
+ return (0);
}
Modified: soc2012/gmiller/locking-head/tools/regression/lib/libwitness/bless.c
==============================================================================
--- soc2012/gmiller/locking-head/tools/regression/lib/libwitness/bless.c Mon Aug 20 06:11:04 2012 (r240555)
+++ soc2012/gmiller/locking-head/tools/regression/lib/libwitness/bless.c Mon Aug 20 08:37:51 2012 (r240556)
@@ -78,9 +78,10 @@
void
check_unbless(void)
{
- int record_count = 0;
+ int record_count;
struct pthread_lor_np lor;
+ record_count = 0;
pthread_lor_begin_np(&lor);
while (pthread_lor_next_np(&lor)) {
record_count++;
@@ -93,9 +94,10 @@
void
check_bless(void)
{
- int record_count = 0;
+ int record_count;
struct pthread_lor_np lor;
+ record_count = 0;
pthread_lor_begin_np(&lor);
while (pthread_lor_next_np(&lor)) {
record_count++;
Modified: soc2012/gmiller/locking-head/tools/regression/lib/libwitness/check.c
==============================================================================
--- soc2012/gmiller/locking-head/tools/regression/lib/libwitness/check.c Mon Aug 20 06:11:04 2012 (r240555)
+++ soc2012/gmiller/locking-head/tools/regression/lib/libwitness/check.c Mon Aug 20 08:37:51 2012 (r240556)
@@ -27,7 +27,7 @@
#include <stdio.h>
-#define MAX_TESTS (100)
+#define MAX_TESTS 100
int success_count = 0;
int fail_count = 0;
@@ -48,7 +48,7 @@
void
show_test_results(void)
{
- int i;
+ int i;
printf("1..%d\n", success_count + fail_count);
Modified: soc2012/gmiller/locking-head/tools/regression/lib/libwitness/check.h
==============================================================================
--- soc2012/gmiller/locking-head/tools/regression/lib/libwitness/check.h Mon Aug 20 06:11:04 2012 (r240555)
+++ soc2012/gmiller/locking-head/tools/regression/lib/libwitness/check.h Mon Aug 20 08:37:51 2012 (r240556)
@@ -25,5 +25,5 @@
*
*/
-void check(char cond);
-void show_test_results(void);
+void check(char cond);
+void show_test_results(void);
Modified: soc2012/gmiller/locking-head/tools/regression/lib/libwitness/graph.c
==============================================================================
--- soc2012/gmiller/locking-head/tools/regression/lib/libwitness/graph.c Mon Aug 20 06:11:04 2012 (r240555)
+++ soc2012/gmiller/locking-head/tools/regression/lib/libwitness/graph.c Mon Aug 20 08:37:51 2012 (r240556)
@@ -55,8 +55,9 @@
void
cycle_locks(pthread_mutex_t *lock_buffer, int *lock_set, int lock_set_size)
{
- int i = 0;
+ int i;
+ i = 0;
while (i < lock_set_size) {
pthread_mutex_lock(&lock_buffer[lock_set[i++]]);
}
@@ -86,10 +87,10 @@
void
all_tests(int lock_count)
{
- int i;
- pthread_mutex_t *lock_buffer;
- int *lock_set;
- char name[11];
+ pthread_mutex_t *lock_buffer;
+ int *lock_set;
+ int i;
+ char name[11];
pthread_lockorder_reset_np();
Modified: soc2012/gmiller/locking-head/tools/regression/lib/libwitness/lor-basic.c
==============================================================================
--- soc2012/gmiller/locking-head/tools/regression/lib/libwitness/lor-basic.c Mon Aug 20 06:11:04 2012 (r240555)
+++ soc2012/gmiller/locking-head/tools/regression/lib/libwitness/lor-basic.c Mon Aug 20 08:37:51 2012 (r240556)
@@ -59,9 +59,10 @@
void
check_lor_basic(void)
{
- int record_count = 0;
+ int record_count;
struct pthread_lor_np lor;
+ record_count = 0;
pthread_lor_begin_np(&lor);
while (pthread_lor_next_np(&lor)) {
record_count++;
Modified: soc2012/gmiller/locking-head/tools/regression/lib/libwitness/setname.c
==============================================================================
--- soc2012/gmiller/locking-head/tools/regression/lib/libwitness/setname.c Mon Aug 20 06:11:04 2012 (r240555)
+++ soc2012/gmiller/locking-head/tools/regression/lib/libwitness/setname.c Mon Aug 20 08:37:51 2012 (r240556)
@@ -56,15 +56,16 @@
void
check_setname(void)
{
- int record_count = 0;
+ int record_count;
struct pthread_lor_np lor;
+ record_count = 0;
pthread_lor_begin_np(&lor);
while (pthread_lor_next_np(&lor)) {
- check((strcmp(lor.name_first, "mutex 1") == 0 &&
- strcmp(lor.name_second, "mutex 2") == 0) ||
- (strcmp(lor.name_first, "mutex 2") == 0 &&
- strcmp(lor.name_second, "mutex 1") == 0));
+ check((strcmp(lor.first_name, "mutex 1") == 0 &&
+ strcmp(lor.second_name, "mutex 2") == 0) ||
+ (strcmp(lor.first_name, "mutex 2") == 0 &&
+ strcmp(lor.second_name, "mutex 1") == 0));
record_count++;
}
Modified: soc2012/gmiller/locking-head/tools/regression/lib/libwitness/setorder.c
==============================================================================
--- soc2012/gmiller/locking-head/tools/regression/lib/libwitness/setorder.c Mon Aug 20 06:11:04 2012 (r240555)
+++ soc2012/gmiller/locking-head/tools/regression/lib/libwitness/setorder.c Mon Aug 20 08:37:51 2012 (r240556)
@@ -62,9 +62,10 @@
void
check_unset(void)
{
- int record_count = 0;
+ int record_count;
struct pthread_lor_np lor;
+ record_count = 0;
pthread_lor_begin_np(&lor);
while (pthread_lor_next_np(&lor)) {
record_count++;
@@ -77,9 +78,10 @@
void
check_set(void)
{
- int record_count = 0;
+ int record_count;
struct pthread_lor_np lor;
+ record_count = 0;
pthread_lor_begin_np(&lor);
while (pthread_lor_next_np(&lor)) {
record_count++;
Modified: soc2012/gmiller/locking-head/tools/regression/lib/libwitness/shared.c
==============================================================================
--- soc2012/gmiller/locking-head/tools/regression/lib/libwitness/shared.c Mon Aug 20 06:11:04 2012 (r240555)
+++ soc2012/gmiller/locking-head/tools/regression/lib/libwitness/shared.c Mon Aug 20 08:37:51 2012 (r240556)
@@ -94,9 +94,10 @@
void
check_shared(void)
{
+ int lor_count;
struct pthread_lor_np lor;
- int lor_count = 0;
+ lor_count = 0;
pthread_lor_begin_np(&lor);
while (pthread_lor_next_np(&lor)) {
lor_count++;
More information about the svn-soc-all
mailing list