*** empty log message ***

svn path=/trunk/boinc_samples/; revision=12256
This commit is contained in:
David Anderson 2007-03-20 20:09:37 +00:00
parent 1a48757db8
commit 9d8e75f6fe
4 changed files with 27 additions and 15 deletions

View File

@ -279,3 +279,13 @@ David 21 Feb 2007
libboinc.vcproj
wrapper/
wrapper.C
David 20 Mar 2007
- wrapper (Unix) get actual CPU time of child (not wall time)
- uppercase (Unix): change makefile to work on FC6
uppercase/
Makefile
uc_graphics.C
wrapper/
wrapper.C

View File

@ -19,9 +19,10 @@ CXXFLAGS = -g \
-L.
# the following should be freeglut; use nm to check
# you may have to change the paths for your system
LIBGLUT = /usr/local/lib/libglut.a
LIBGLU = /usr/X11R6/lib/libGLU.a
LIBJPEG = /usr/lib/libjpeg.a
LIBGLU = /usr/local/lib/libGLU.a
LIBJPEG = /usr/local/lib/libjpeg.a
PROGS = upper_case upper_case.so
@ -43,4 +44,5 @@ upper_case.so: uc_graphics.o $(BOINC_LIB_DIR)/libboinc.a $(BOINC_API_DIR)/libboi
libstdc++.a \
-lboinc_graphics_impl -lboinc \
$(LIBGLUT) $(LIBGLU) $(LIBJPEG) \
-lGL -lX11 -lXmu -lm \
-lGL -lX11 -lXmu -lm; \
chcon -t texrel_shlib_t upper_case.so

View File

@ -156,6 +156,8 @@ static void app_init_camera(double dist) {
set_viewpoint(dist);
}
extern "C" {
void app_graphics_render(int xs, int ys, double time_of_day) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
mode_unshaded();
@ -218,3 +220,4 @@ void boinc_app_key_press(int, int){}
void boinc_app_key_release(int, int){}
}

View File

@ -41,6 +41,7 @@
#else
#include <unistd.h>
#include <sys/wait.h>
#include "procinfo.h"
#endif
#include "boinc_api.h"
@ -358,18 +359,14 @@ double TASK::cpu_time() {
double cpu = totTime / 1.e7;
return cpu;
#else
// Unix variant: return elapsed wall time
// TODO: get CPU time from /proc
//
static double t=0, cpu;
if (t) {
double now = dtime();
cpu += now-t;
t = now;
} else {
t = dtime();
}
return cpu;
vector<PROCINFO> pi;
procinfo_setup(pi);
PROCINFO proc;
memset(&proc, 0, sizeof(proc));
proc.id = pid;
procinfo_app(proc, pi);
printf("time: %f\n", proc.user_time+proc.kernel_time);
return proc.user_time + proc.kernel_time;
#endif
}