Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
6d881a09
Commit
6d881a09
authored
May 22, 2002
by
Chad Barb
Browse files
Added report of CPU time, from getrusage(), when running with "-v -v".
(Added for my timing tests.)
parent
6a00b82f
Changes
1
Hide whitespace changes
Inline
Side-by-side
tbsetup/wanlinksolve.cc
View file @
6d881a09
...
...
@@ -92,12 +92,15 @@
#include <unistd.h>
#include <assert.h>
#include <math.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
// To keep things lightweight,
// structures are statically sized to
// accommodate up to MAX_NODES nodes.
// These could be changed to STL vectors in the future.
#define MAX_NODES 2
0
#define MAX_NODES
3
2
#define MAX_DIMENSIONS 2
// default rounds to keep going without finding a better solution.
...
...
@@ -544,10 +547,21 @@ void usage( char * appname )
exit
(
1
);
}
unsigned
int
msecscpu
()
{
struct
rusage
r
;
getrusage
(
0
,
&
r
);
return
r
.
ru_utime
.
tv_sec
*
1000
+
r
.
ru_utime
.
tv_usec
/
1000
;
}
int
main
(
int
argc
,
char
**
argv
)
{
int
available
=
0
;
int
fixedNodeCount
=
0
;
unsigned
int
bestSpeed
=
0
;
verbose
=
0
;
dimensions
=
1
;
...
...
@@ -586,7 +600,7 @@ int main( int argc, char ** argv )
}
char
line
[
1024
];
char
line
[
4096
];
{
if
(
verbose
>
1
)
{
printf
(
"How many physical nodes?
\n
"
);
}
...
...
@@ -744,6 +758,7 @@ int main( int argc, char ** argv )
printf
(
"Better solution found in round %i (error %4.3f)
\n
"
,
i
,
currentPool
[
0
].
error
);
}
bestSpeed
=
msecscpu
();
last
=
currentPool
[
0
].
error
;
highestFoundRound
=
i
;
}
...
...
@@ -813,7 +828,10 @@ int main( int argc, char ** argv )
printf
(
"
\n
"
);
// dump a detailed report of the returned solution's errors.
if
(
verbose
>
1
)
{
calcError
<
true
>
(
&
(
currentPool
[
0
])
);
}
if
(
verbose
>
1
)
{
calcError
<
true
>
(
&
(
currentPool
[
0
])
);
printf
(
"Found in %i msecs
\n
"
,
bestSpeed
);
}
}
if
(
verbose
>
1
)
{
printf
(
"Bye now.
\n
"
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment