Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
boinc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
einsteinathome
boinc
Commits
c30bd622
Commit
c30bd622
authored
10 years ago
by
Rom Walton
Browse files
Options
Downloads
Patches
Plain Diff
VBOX: Report CPU Time instead of elapsed time to boinc_report_app_status()
parent
b07ac77a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
samples/vboxwrapper/vbox.cpp
+8
-0
8 additions, 0 deletions
samples/vboxwrapper/vbox.cpp
samples/vboxwrapper/vbox.h
+2
-0
2 additions, 0 deletions
samples/vboxwrapper/vbox.h
samples/vboxwrapper/vboxwrapper.cpp
+20
-15
20 additions, 15 deletions
samples/vboxwrapper/vboxwrapper.cpp
with
30 additions
and
15 deletions
samples/vboxwrapper/vbox.cpp
+
8
−
0
View file @
c30bd622
...
...
@@ -1979,6 +1979,14 @@ int VBOX_VM::get_vm_exit_code(unsigned long& exit_code) {
return
0
;
}
double
VBOX_VM
::
get_vm_cpu_time
()
{
double
x
=
process_tree_cpu_time
(
vm_pid
);
if
(
x
>
current_cpu_time
)
{
current_cpu_time
=
x
;
}
return
current_cpu_time
;
}
int
VBOX_VM
::
get_port_forwarding_port
()
{
sockaddr_in
addr
;
BOINC_SOCKLEN_T
addrsize
;
...
...
This diff is collapsed.
Click to expand it.
samples/vboxwrapper/vbox.h
+
2
−
0
View file @
c30bd622
...
...
@@ -98,6 +98,7 @@ public:
// maximum amount of wall-clock time this VM is allowed to run before
// considering itself done.
double
job_duration
;
double
current_cpu_time
;
// name of file where app will write its fraction done
std
::
string
fraction_done_filename
;
// is the VM suspended?
...
...
@@ -193,6 +194,7 @@ public:
int
get_vm_network_bytes_received
(
double
&
received
);
int
get_vm_process_id
();
int
get_vm_exit_code
(
unsigned
long
&
exit_code
);
double
get_vm_cpu_time
();
int
get_system_log
(
std
::
string
&
log
,
bool
tail_only
=
true
);
int
get_vm_log
(
std
::
string
&
log
,
bool
tail_only
=
true
);
...
...
This diff is collapsed.
Click to expand it.
samples/vboxwrapper/vboxwrapper.cpp
+
20
−
15
View file @
c30bd622
...
...
@@ -378,6 +378,7 @@ int main(int argc, char** argv) {
double
trickle_period
=
0
;
double
fraction_done
=
0
;
double
checkpoint_cpu_time
=
0
;
double
current_cpu_time
=
0
;
double
last_status_report_time
=
0
;
double
last_trickle_report_time
=
0
;
double
stopwatch_starttime
=
0
;
...
...
@@ -1000,16 +1001,11 @@ int main(int argc, char** argv) {
}
}
if
(
boinc_time_to_checkpoint
())
{
// Only peform a VM checkpoint every ten minutes or so.
// Basic bookkeeping
//
if
(
elapsed_time
>=
checkpoint_cpu_time
+
random_checkpoint_factor
+
600.0
)
{
// Basic interleave factor is only needed once.
if
(
random_checkpoint_factor
>
0
)
{
random_checkpoint_factor
=
0.0
;
if
((
int
)
elapsed_time
%
10
)
{
current_cpu_time
=
vm
.
get_vm_cpu_time
();
}
// Basic bookkeeping
if
(
vm
.
job_duration
)
{
fraction_done
=
elapsed_time
/
vm
.
job_duration
;
}
else
if
(
vm
.
fraction_done_filename
.
size
()
>
0
)
{
...
...
@@ -1018,6 +1014,20 @@ int main(int argc, char** argv) {
if
(
fraction_done
>
1.0
)
{
fraction_done
=
1.0
;
}
boinc_report_app_status
(
current_cpu_time
,
checkpoint_cpu_time
,
fraction_done
);
if
(
boinc_time_to_checkpoint
())
{
// Only peform a VM checkpoint every ten minutes or so.
//
if
(
elapsed_time
>=
checkpoint_cpu_time
+
random_checkpoint_factor
+
600.0
)
{
// Basic interleave factor is only needed once.
if
(
random_checkpoint_factor
>
0
)
{
random_checkpoint_factor
=
0.0
;
}
if
((
elapsed_time
-
last_status_report_time
)
>=
6000.0
)
{
last_status_report_time
=
elapsed_time
;
...
...
@@ -1078,11 +1088,6 @@ int main(int argc, char** argv) {
//
checkpoint_cpu_time
=
elapsed_time
;
write_checkpoint
(
checkpoint_cpu_time
,
vm
);
boinc_report_app_status
(
elapsed_time
,
checkpoint_cpu_time
,
fraction_done
);
boinc_checkpoint_completed
();
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment