aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-10-16 16:28:35 +0200
committerThomas White <taw@physics.org>2014-10-23 17:02:32 +0200
commitcb08ffbe0adeed6502db70f3380059800464726d (patch)
tree0dccc8ee60ccad060fbb8778c4c15a3e52fa0074 /src
parent64a006630632c58be1ca740d7f12041879da6e00 (diff)
Add serial numbers to chunks
Diffstat (limited to 'src')
-rw-r--r--src/im-sandbox.c16
-rw-r--r--src/process_image.c4
-rw-r--r--src/process_image.h3
3 files changed, 19 insertions, 4 deletions
diff --git a/src/im-sandbox.c b/src/im-sandbox.c
index 4d010cc2..45a058ba 100644
--- a/src/im-sandbox.c
+++ b/src/im-sandbox.c
@@ -108,6 +108,7 @@ struct sandbox
int *filename_pipes;
int *stream_pipe_write;
struct filename_plus_event **last_filename;
+ int serial;
char *tmpdir;
@@ -444,8 +445,9 @@ static void run_work(const struct index_args *iargs,
char filename[1024];
char event_str[1024];
struct event* ev;
+ int ser;
- sscanf(bd.line, "%s %s", filename, event_str);
+ sscanf(bd.line, "%s %s %i", filename, event_str, &ser);
pargs.filename_p_e->filename = strdup(filename);
if ( strcmp(event_str, "/") != 0 ) {
@@ -465,7 +467,7 @@ static void run_work(const struct index_args *iargs,
pargs.n_crystals = 0;
process_image(iargs, &pargs, st, cookie, tmpdir,
- results_pipe);
+ results_pipe, ser);
/* Request another image */
c = sprintf(buf, "%i\n", pargs.n_crystals);
@@ -903,6 +905,7 @@ void create_sandbox(struct index_args *iargs, int n_proc, char *prefix,
sb->suspend_stats = 0;
sb->n_proc = n_proc;
sb->iargs = iargs;
+ sb->serial = 1;
sb->reader->fds = NULL;
sb->reader->fhs = NULL;
@@ -1124,6 +1127,8 @@ void create_sandbox(struct index_args *iargs, int n_proc, char *prefix,
} else {
+ char tmp[256];
+
r = write(sb->filename_pipes[i],
nextImage->filename,
strlen(nextImage->filename));
@@ -1155,6 +1160,13 @@ void create_sandbox(struct index_args *iargs, int n_proc, char *prefix,
}
+ snprintf(tmp, 255, " %i", sb->serial++);
+ r = write(sb->filename_pipes[i],
+ tmp, strlen(tmp));
+ if ( r < 0 ) {
+ ERROR("write pipe\n");
+ }
+
r = write(sb->filename_pipes[i], "\n", 1);
if ( r < 0 ) {
ERROR("write pipe\n");
diff --git a/src/process_image.c b/src/process_image.c
index 225d50e3..68708fd7 100644
--- a/src/process_image.c
+++ b/src/process_image.c
@@ -112,7 +112,8 @@ static void refine_radius(Crystal *cr)
void process_image(const struct index_args *iargs, struct pattern_args *pargs,
- Stream *st, int cookie, const char *tmpdir, int results_pipe)
+ Stream *st, int cookie, const char *tmpdir, int results_pipe,
+ int serial)
{
float *data_for_measurement;
size_t data_size;
@@ -134,6 +135,7 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs,
image.det = iargs->det;
image.crystals = NULL;
image.n_crystals = 0;
+ image.serial = serial;
hdfile = hdfile_open(image.filename);
if ( hdfile == NULL ) {
diff --git a/src/process_image.h b/src/process_image.h
index 7c48d711..5d9f2c27 100644
--- a/src/process_image.h
+++ b/src/process_image.h
@@ -99,7 +99,8 @@ struct pattern_args
extern void process_image(const struct index_args *iargs,
struct pattern_args *pargs, Stream *st,
- int cookie, const char *tmpdir, int results_pipe);
+ int cookie, const char *tmpdir, int results_pipe,
+ int serial);
#endif /* PROCESS_IMAGEs_H */