MIDAS
Loading...
Searching...
No Matches
mstat.cxx File Reference
#include <assert.h>
#include <fcntl.h>
#include "midas.h"
#include "msystem.h"
#include "mstrlcpy.h"
#include <sstream>
Include dependency graph for mstat.cxx:

Go to the source code of this file.

Macros

#define MAX_LINE   80
 
#define LINE_LENGTH   80
 
#define ESC_FLAG   1
 

Functions

INT open_log_midstat (INT file_mode, INT runn, char *svpath)
 
void compose_status (HNDLE hDB, HNDLE hKey)
 
int main (int argc, char **argv)
 

Variables

INT rn
 
INT numprocs
 
DWORD checktime
 
DWORD lastchecktime
 
DWORD delta_time
 
INT nlocal
 
HNDLE hKeynlocal
 
HNDLE hKeychktime
 
BOOL active_flag
 
BOOL esc_flag
 
INT loop
 
INT cur_max_line
 
std::string xststr [MAX_LINE]
 

Macro Definition Documentation

◆ ESC_FLAG

#define ESC_FLAG   1

Definition at line 27 of file mstat.cxx.

◆ LINE_LENGTH

#define LINE_LENGTH   80

Definition at line 22 of file mstat.cxx.

◆ MAX_LINE

#define MAX_LINE   80

Definition at line 21 of file mstat.cxx.

Function Documentation

◆ compose_status()

void compose_status ( HNDLE  hDB,
HNDLE  hKey 
)
  • remove '/0' *‍/

Definition at line 75 of file mstat.cxx.

76{
78 INT i, size;
79 char str[80], path[256];
80 KEY key;
82 char strtmp[256];
83
84 /* Clear string page */
85 for (int jj = 0; jj < MAX_LINE; jj++) {
86 xststr[jj].clear();
87 }
88
89 int j = 0;
90
91/* --------------------- Run info -------------------------------- */
92 {
93
94 INT rs, rt;
95 char cs[80], stt[80], spt[80], ex[80], rev[256], rev1[256];
96 DWORD tb, tsb;
97
98 size = sizeof(rs);
99 db_get_value(hDB, 0, "/Runinfo/State", &rs, &size, TID_INT, TRUE);
100 if (rs == STATE_RUNNING)
101 strcpy(cs, "Running");
102 if (rs == STATE_PAUSED)
103 strcpy(cs, "Paused ");
104 if (rs == STATE_STOPPED)
105 strcpy(cs, "Stopped");
106 size = sizeof(rn);
107 db_get_value(hDB, 0, "/Runinfo/run number", &rn, &size, TID_INT, TRUE);
108 size = sizeof(stt);
109 db_get_value(hDB, 0, "/Runinfo/start time", stt, &size, TID_STRING, TRUE);
110 size = sizeof(spt);
111 db_get_value(hDB, 0, "/Runinfo/stop time", spt, &size, TID_STRING, TRUE);
112 size = sizeof(tb);
113 db_get_value(hDB, 0, "/runinfo/Start Time binary", &tb, &size, TID_DWORD, TRUE);
114 size = sizeof(tsb);
115 db_get_value(hDB, 0, "/runinfo/Stop Time binary", &tsb, &size, TID_DWORD, TRUE);
116 size = sizeof(rt);
117 db_get_value(hDB, 0, "/Runinfo/Requested transition", &rt, &size, TID_INT, TRUE);
118
119 /* Experiment info */
120 size = sizeof(ex);
121 db_get_value(hDB, 0, "/experiment/name", ex, &size, TID_STRING, TRUE);
122
123 {
125 time(&full_time);
126 assert(sizeof(str) >= 32);
128 str[24] = 0;
129 }
130// if (active_flag) {
131// sprintf(&(ststr[j++][0]), "*- MIDAS revision: %s - MIDAS status -- Alarm Checker active-------*", cm_get_revision());
132// j++; sprintf(&(ststr[j++][0]), "-%s-*", str);
133// } else
134 {
135 sprintf(rev1, "%s", cm_get_revision());
136 strcpy(rev, strstr(rev1, "midas"));
137 xststr[j++] = msprintf("*- MIDAS Status Page -%s ----------------------------*", str);
138 xststr[j++] = msprintf("*- Revision -%s---------*", rev);
139 }
140
141 xststr[j] = msprintf("Experiment: %s, ", ex);
142 xststr[j] += msprintf("Run: %d, ", rn);
143
144 /* PAA revisit the /Runinfo for run time display */
145 /* state */
146 if (rs == STATE_RUNNING) {
147 if (rt == TR_STOP)
148 xststr[j] += msprintf(" Deferred_Stop");
149 else {
150 if (esc_flag)
151 xststr[j] += msprintf("State: \033[1m%s\033[m", cs);
152 else
153 xststr[j] += msprintf("State: %s", cs);
154 }
155 } else {
156 if (rt == TR_START)
157 xststr[j] += msprintf("Deferred_Start");
158 else
159 xststr[j] += msprintf("State: %s", cs);
160 }
161
162 j++;
163
164 /* time */
165 if (rs != STATE_STOPPED) {
169 if (esc_flag)
170 xststr[j++] = msprintf("Run time: %02d:%02d:%02d", difftime / 3600, difftime % 3600 / 60, difftime % 60);
171 else
172 xststr[j++] = msprintf("Run time: %02d:%02d:%02d", difftime / 3600, difftime % 3600 / 60, difftime % 60);
173
174 xststr[j++] = msprintf("Start time: %s", stt);
175 } else if (rs == STATE_STOPPED) {
177 if (tsb < tb)
178 difftime = 0;
179 else
180 difftime = tsb - tb;
181 if (esc_flag)
182 xststr[j++] = msprintf("Full Run time: %02d:%02d:%02d", difftime / 3600, difftime % 3600 / 60, difftime % 60);
183 else
184 xststr[j++] = msprintf("Full Run time: %02d:%02d:%02d", difftime / 3600, difftime % 3600 / 60, difftime % 60);
185
186 xststr[j++] = msprintf("Start time: %s", stt);
187 xststr[j++] += msprintf("Stop time: %s", spt);
188 }
189 xststr[j++] = "";
190 } /* --- run info --- */
191
192/* --------------------- Equipment tree -------------------------- */
193 {
194 double equevtsend;
195 double equevtpsec;
196 char equclient[256];
197 char equnode[256];
198 double equkbpsec;
200
201 size = sizeof(str);
203 /* check if dir exists */
204 if (db_find_key(hDB, 0, "/equipment", &hKey) == DB_SUCCESS) {
205 xststr[j++] = "FE Equip. Node Evts Taken Evt Rate[/s] Data Rate[Kb/s]";
206 for (i = 0;; i++) {
208 if (!hSubkey)
209 break;
211 if ((key.type == TID_KEY) &&
212 ((strstr(key.name, "ODB")) == NULL) &&
213 ((strstr(key.name, "BOR")) == NULL) &&
214 ((strstr(key.name, "EOR")) == NULL)) {
215 /* check if client running this equipment is present */
216 /* extract client name from equipment */
217 size = sizeof(equclient);
218 sprintf(strtmp, "/equipment/%s/common/Frontend name", key.name);
220 /* search client name under /system/clients/xxx/name */
223 size = sizeof(equenabled);
224 sprintf(strtmp, "/equipment/%s/common/enabled", key.name);
226
227 size = sizeof(equevtsend);
228 sprintf(strtmp, "/equipment/%s/statistics/events sent", key.name);
230
231 size = sizeof(equevtpsec);
232 sprintf(strtmp, "/equipment/%s/statistics/events per sec.", key.name);
234
235 size = sizeof(equkbpsec);
236 sprintf(strtmp, "/equipment/%s/statistics/kBytes per sec.", key.name);
238
239 size = sizeof(equnode);
240 sprintf(strtmp, "/equipment/%s/common/Frontend host", key.name);
242 {
243 char *pp, sdummy[257];
244 memset(sdummy, 0, 64);
245 xststr[j] = msprintf("%-11s ", key.name);
246 pp = strchr(equnode, '.');
247 if (pp != NULL)
248 xststr[j] += msprintf("%-18s", strncpy(sdummy, equnode, pp - equnode));
249 else
250 xststr[j] += msprintf("%-18s", strncpy(sdummy, equnode, sizeof(sdummy)-1));
251
252 if (equevtsend > 1E9)
253 xststr[j] += msprintf("%10.3lfG", equevtsend / 1E9);
254 else if (equevtsend > 1E6)
255 xststr[j] += msprintf("%10.3lfM", equevtsend / 1E6);
256 else
257 xststr[j] += msprintf("%10.0lf", equevtsend);
258
259 xststr[j] += " ";
260
261 if (equenabled) {
262 if (esc_flag) {
263 xststr[j] += msprintf("\033[7m%12.1lf\033[m", equevtpsec);
264 xststr[j] += " ";
265 xststr[j] += msprintf("%12.1lf", equkbpsec);
266 } else {
267 xststr[j] += msprintf("%12.1lf", equevtpsec);
268 xststr[j] += " ";
269 xststr[j] += msprintf("%12.1lf", equkbpsec);
270 }
271 } else {
272 xststr[j] += msprintf("%12.1lf", equevtpsec);
273 xststr[j] += " ";
274 xststr[j] += msprintf("%12.1lf", equkbpsec);
275 }
276 j++;
277 } /* get value */
278 } /* active */
279 } /* eor==NULL */
280 } /* for equipment */
281 }
282 /* Front-End message */
283 if (!atleastone_active) {
284 xststr[j++] = "... No Front-End currently running...";
285 }
286 } /* --- Equipment tree --- */
287
288/* --------------------- Logger tree ----------------------------- */
289/* search client name "Logger" under /system/clients/xxx/name */
290 if ((cm_exist("logger", FALSE) == CM_SUCCESS)
291 || (cm_exist("fal", FALSE) == CM_SUCCESS)) {
292 char datadir[256];
293 BOOL wd, lactive;
294 char lpath[256];
295 char ltype[64];
296 char lstate[64];
297 double levt;
298 double lbyt;
299
300 /* logger */
301 xststr[j++] = "";
302 size = sizeof(datadir);
303 db_get_value(hDB, 0, "/logger/data dir", datadir, &size, TID_STRING, TRUE);
304 std::string mesfile;
306 size = sizeof(wd);
307 db_get_value(hDB, 0, "/logger/write data", &wd, &size, TID_BOOL, TRUE);
308 xststr[j] = msprintf("Logger Data dir: %s", datadir);
309 j++;
310 xststr[j] = msprintf("Msg File: %s", mesfile.c_str());
311 j++;
312
313 /* check if dir exists */
314 if (db_find_key(hDB, 0, "/logger/channels", &hKey) == DB_SUCCESS) {
315 xststr[j++] = "Chan. Active Type Filename Events Taken KBytes Taken";
316 for (i = 0;; i++) {
318 if (!hSubkey)
319 break;
321 if (key.type == TID_KEY) {
322 size = sizeof(lactive);
323 sprintf(strtmp, "/logger/channels/%s/settings/active", key.name);
324 db_get_value(hDB, 0, strtmp, &lactive, &size, TID_BOOL, TRUE);
325 sprintf(lstate, "No");
326 if (lactive)
327 sprintf(lstate, "Yes");
328 size = sizeof(lpath);
329 sprintf(strtmp, "/logger/channels/%s/settings/Filename", key.name);
331
332 /* substitue "%d" by current run number */
333 str[0] = 0;
334 strcat(str, lpath);
335 if (strchr(str, '%'))
336 sprintf(path, str, rn);
337 else
338 strcpy(path, str);
339 strcpy(lpath, path);
340
341 size = sizeof(ltype);
342 sprintf(strtmp, "/logger/channels/%s/settings/type", key.name);
344
345 size = sizeof(levt);
346 sprintf(strtmp, "/logger/channels/%s/statistics/Events written", key.name);
347 db_get_value(hDB, 0, strtmp, &levt, &size, TID_DOUBLE, TRUE);
348
349 size = sizeof(lbyt);
350 sprintf(strtmp, "/logger/channels/%s/statistics/Bytes written", key.name);
351 db_get_value(hDB, 0, strtmp, &lbyt, &size, TID_DOUBLE, TRUE);
352 lbyt /= 1024;
353 if (lactive) {
354 if (esc_flag) {
355 xststr[j] = msprintf(" \033[7m%-3s\033[m", key.name);
356 } else { /* no esc */
357 xststr[j] = msprintf(" %-3s", key.name);
358 }
359 xststr[j] += " ";
360 if (wd == 1)
361 xststr[j] += msprintf("%-6s", lstate);
362 else
363 xststr[j] += msprintf("(%-4s)", lstate);
364 xststr[j] += " ";
365 xststr[j] += msprintf("%-7s", ltype);
366 xststr[j] += " ";
367 xststr[j] += msprintf("%-15s", lpath);
368 xststr[j] += " ";
369 xststr[j] += msprintf("%12.0f", levt);
370 xststr[j] += " ";
371 xststr[j] += msprintf("%12.2e", lbyt);
372 } else { /* not active */
373 xststr[j] = msprintf(" %-3s", key.name);
374 xststr[j] += " ";
375 if (wd == 1)
376 xststr[j] += msprintf("%-6s", lstate);
377 else
378 xststr[j] += msprintf("(%-4s)", lstate);
379 xststr[j] += " ";
380 xststr[j] += msprintf("%-7s", ltype);
381 xststr[j] += " ";
382 xststr[j] += msprintf("%-15s", lpath);
383 xststr[j] += " ";
384 xststr[j] += msprintf("%12.0f", levt);
385 xststr[j] += " ";
386 xststr[j] += msprintf("%12.2e", lbyt);
387 }
388 j++;
389 } /* key */
390 } /* for */
391 } /* exists */
392 } else {
393 xststr[j++] = msprintf("... Logger currently not running...");
394 }
395
396/* --------------------- Lazy logger tree ------------------------ */
397/* include lazy if running */
398/* search client name under /system/clients/xxx/name */
399 {
400 float cr, bs;
401 INT status, nf, size, i, k;
402 char bn[128], tl[128];
404 char client_name[NAME_LENGTH];
405
406 status = db_find_key(hDB, 0, "System/Clients", &hKey);
407 if (status != DB_SUCCESS)
408 return;
409
410 k = 0;
411 /* loop over all clients */
412 for (i = 0;; i++) {
415 break;
416
417 if (status == DB_SUCCESS) {
418 /* get client name */
419 size = sizeof(client_name);
420 db_get_value(hDB, hSubkey, "Name", client_name, &size, TID_STRING, TRUE);
421 client_name[4] = 0; /* search only for the 4 first char */
422 if (equal_ustring(client_name, "Lazy")) {
423 sprintf(str, "/Lazy/%s", &client_name[5]);
424 status = db_find_key(hDB, 0, str, &hlKey);
425 if (status == DB_SUCCESS) {
426 size = sizeof(tl);
427 db_get_value(hDB, hlKey, "/Settings/List label", tl, &size, TID_STRING, TRUE);
428 if (*tl == '\0')
429 sprintf(tl, "<empty>");
430 size = sizeof(cr);
431 db_get_value(hDB, hlKey, "statistics/Copy progress (%)", &cr, &size, TID_DOUBLE, TRUE);
432 size = sizeof(nf);
433 db_get_value(hDB, hlKey, "statistics/Number of Files", &nf, &size, TID_INT, TRUE);
434 size = sizeof(bs);
435 db_get_value(hDB, hlKey, "statistics/Backup status (%)", &bs, &size, TID_DOUBLE, TRUE);
436 size = sizeof(bn);
437 db_get_value(hDB, hlKey, "statistics/Backup file", bn, &size, TID_STRING, TRUE);
438
439 if (k == 0) {
440 xststr[j++] = "";
441 //sprintf(ststr[j++],"");
442 xststr[j] = msprintf("%s %15s %25s %45s %60s", "Lazy Label", "Progress", "File name", "#files", "Total"); // FIXME
443 }
444 xststr[j] = msprintf("%15s %.0f[%%] %s %i %.1f[%%]", tl, cr, bn, nf, bs); // FIXME
445 k++;
446 }
447 }
448 }
449 }
450 }
451
452 xststr[j++] = "";
453
454/* --------------------- System client list ---------------------- */
455/* Get current Client listing */
456 if (db_find_key(hDB, 0, "/system/clients", &hKey) == DB_SUCCESS) {
457 char clientn[256], clienth[256];
458 char *pp, sdummy[64];
459
460 xststr[j] = "Clients:";
461 for (int i = 0;; i++) {
463 if (!hSubkey)
464 break;
466
467 memset(strtmp, 0, sizeof(strtmp));
468 size = sizeof(clientn);
469 sprintf(strtmp, "name");
471 memset(strtmp, 0, sizeof(strtmp));
472 size = sizeof(clienth);
473 sprintf(strtmp, "host");
475 memset(sdummy, 0, 64);
476 pp = strchr(clienth, '.');
477 if (pp != NULL)
478 xststr[j] += msprintf(" %s/%s", clientn, strncpy(sdummy, clienth, pp - clienth));
479 else
480 xststr[j] += msprintf(" %s/%s", clientn, clienth);
481 }
482 j++;
483 }
484
485 if (loop == 1) {
486 xststr[j++] = msprintf("*- [!] to Exit ------- [R] to Refresh ---------------------- Delay:%2.i [sec]-*", delta_time / 1000);
487 } else {
488 xststr[j++] = "*---------------------------------------------------------------------------*";
489 }
490
491 cur_max_line = j;
492
494 //for (int j = 0; j < MAX_LINE; j++)
495 // while (strlen(ststr[j]) < (LINE_LENGTH - 1))
496 // ststr[j][strlen(ststr[j])] = ' ';
497 return;
498}
#define FALSE
Definition cfortran.h:309
const char * cm_get_revision()
Definition midas.cxx:1484
INT cm_time(DWORD *t)
Definition midas.cxx:1434
INT cm_exist(const char *name, BOOL bUnique)
Definition midas.cxx:7520
#define CM_SUCCESS
Definition midas.h:582
#define DB_SUCCESS
Definition midas.h:631
#define DB_NO_MORE_SUBKEYS
Definition midas.h:646
unsigned int DWORD
Definition mcstd.h:51
#define TID_DOUBLE
Definition midas.h:343
#define TID_KEY
Definition midas.h:349
#define TID_BOOL
Definition midas.h:340
#define TR_START
Definition midas.h:405
#define STATE_STOPPED
Definition midas.h:305
#define STATE_PAUSED
Definition midas.h:306
#define TID_STRING
Definition midas.h:346
#define STATE_RUNNING
Definition midas.h:307
#define TID_INT
Definition midas.h:338
#define TR_STOP
Definition midas.h:406
#define TID_DWORD
Definition midas.h:336
void cm_msg_get_logfile(const char *fac, time_t t, std::string *filename, std::string *linkname, std::string *linktarget)
Definition midas.cxx:539
BOOL equal_ustring(const char *str1, const char *str2)
Definition odb.cxx:3201
INT db_get_value(HNDLE hDB, HNDLE hKeyRoot, const char *key_name, void *data, INT *buf_size, DWORD type, BOOL create)
Definition odb.cxx:5415
INT db_get_key(HNDLE hDB, HNDLE hKey, KEY *key)
Definition odb.cxx:6019
INT db_find_key(HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
Definition odb.cxx:4079
INT db_enum_key(HNDLE hDB, HNDLE hKey, INT idx, HNDLE *subkey_handle)
Definition odb.cxx:5586
HNDLE hKey
ANA_TEST ** tl
Definition mana.cxx:543
HNDLE hDB
main ODB handle
Definition mana.cxx:207
KEY key
Definition mdump.cxx:34
INT i
Definition mdump.cxx:32
HNDLE hSubkey
Definition mdump.cxx:35
#define DWORD
Definition mhdump.cxx:31
std::string msprintf(const char *format,...)
Definition midas.cxx:410
INT HNDLE
Definition midas.h:132
DWORD BOOL
Definition midas.h:105
int INT
Definition midas.h:129
#define TRUE
Definition midas.h:182
#define NAME_LENGTH
Definition midas.h:272
INT loop
Definition mstat.cxx:39
INT rn
Definition mstat.cxx:30
DWORD delta_time
Definition mstat.cxx:35
std::string xststr[MAX_LINE]
Definition mstat.cxx:40
#define MAX_LINE
Definition mstat.cxx:21
BOOL esc_flag
Definition mstat.cxx:38
INT cur_max_line
Definition mstat.cxx:39
INT j
Definition odbhist.cxx:40
INT k
Definition odbhist.cxx:40
char str[256]
Definition odbhist.cxx:33
DWORD status
Definition odbhist.cxx:39
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24
Definition midas.h:1026
DWORD type
Definition midas.h:1027
char name[NAME_LENGTH]
Definition midas.h:1029
Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 501 of file mstat.cxx.

502{
504 HNDLE hDB, hKey;
506 char svpath[256], strdis[80];
507 signed char ch;
508 INT fHandle, i, j = 0, last_max_line = 0;
509 INT msg;
510 BOOL debug;
511
513
514 /* set default */
516 svpath[0] = 0;
517 file_mode = 1;
518 loop = 0;
519 delta_time = 5000;
520
521 /* get parameters */
522 /* parse command line parameters */
523 for (i = 1; i < argc; i++) {
524 if (argv[i][0] == '-' && argv[i][1] == 'd')
525 debug = TRUE;
526 else if (strncmp(argv[i], "-l", 2) == 0)
527 loop = 1;
528 else if (argv[i][0] == '-') {
529 if (i + 1 >= argc || argv[i + 1][0] == '-')
530 goto usage;
531 if (strncmp(argv[i], "-w", 2) == 0)
532 delta_time = 1000 * (atoi(argv[++i]));
533 else if (strncmp(argv[i], "-f", 2) == 0)
534 strcpy(svpath, argv[++i]);
535 else if (strncmp(argv[i], "-e", 2) == 0)
536 strcpy(expt_name, argv[++i]);
537 else if (strncmp(argv[i], "-h", 2) == 0)
538 strcpy(host_name, argv[++i]);
539 else if (strncmp(argv[i], "-c", 2) == 0) {
540 strcpy(str, argv[++i]);
541 if (strncmp(str, "n", 1) == 0 || strncmp(str, "N", 1) == 0)
542 file_mode = 0;
543 } else {
544 usage:
545 printf("usage: mstat -l (loop) -w delay (5sec) -f filename (null)\n");
546 printf(" -c compose (Addrun#/norun#)\n");
547 printf(" [-h Hostname] [-e Experiment]\n\n");
548 return 0;
549 }
550 }
551 }
552
553 if (debug) // avoid complaint about unused "debug"
554 status = SUCCESS;
555
556 /* connect to experiment */
558 if (status != CM_SUCCESS)
559 return 1;
560
561#ifdef _DEBUG
563#endif
564
565 /* turn off message display, turn on message logging */
567
568 /* connect to the database */
570
571 /* generate status page */
572 if (loop == 0) {
573 j = 0;
574 if (svpath[0] != 0) {
577 esc_flag = 0;
579 while ((j < cur_max_line) && (xststr[j][0] != '\0')) {
580 int wr;
581 strncpy(svpath, xststr[j].c_str(), 80);
582 svpath[80] = '\0';
583 printf("%s\n", svpath);
584 wr = write(fHandle, "\n", 1);
585 assert(wr == 1);
587 assert(wr == (int)xststr[j].length());
588 j++;
589 }
590 close(fHandle);
591 } else {
592 esc_flag = 0;
594 for (int k=0; k<cur_max_line; k++) {
595 printf("%s\n", xststr[k].c_str());
596 }
597 }
598 } else {
599
600 /* initialize ss_getchar() */
601 ss_getchar(0);
602
604
605 do {
606 if ((ss_millitime() - last_time) > delta_time) {
612
613 for (int j=0; j<cur_max_line; j++) {
614 mstrlcpy(strdis, xststr[j].c_str(), sizeof(strdis));
615 ss_printf(0, j, "%s", xststr[j].c_str());
616 }
617 }
618 ch = 0;
619 while (ss_kbhit()) {
620 ch = ss_getchar(0);
621 if (ch == -1)
622 ch = getchar();
623 if (ch == 'R')
625 if ((char) ch == '!')
626 break;
627 }
628 msg = cm_yield(200);
629 } while (msg != RPC_SHUTDOWN && msg != SS_ABORT && ch != '!');
630 }
631 printf("\n");
632
633 /* reset terminal */
635
637 return 1;
638}
static void usage()
INT cm_yield(INT millisec)
Definition midas.cxx:5642
INT cm_get_experiment_database(HNDLE *hDB, HNDLE *hKeyClient)
Definition midas.cxx:3011
INT cm_connect_experiment(const char *host_name, const char *exp_name, const char *client_name, void(*func)(char *))
Definition midas.cxx:2278
INT cm_disconnect_experiment(void)
Definition midas.cxx:2846
INT cm_get_environment(char *host_name, int host_name_size, char *exp_name, int exp_name_size)
Definition midas.cxx:2134
INT cm_set_watchdog_params(BOOL call_watchdog, DWORD timeout)
Definition midas.cxx:3283
#define SS_ABORT
Definition midas.h:677
#define RPC_SHUTDOWN
Definition midas.h:707
#define SUCCESS
Definition mcstd.h:54
#define MT_ALL
Definition midas.h:549
BOOL ss_kbhit()
Definition system.cxx:3664
DWORD ss_millitime()
Definition system.cxx:3393
INT ss_getchar(BOOL reset)
Definition system.cxx:7503
void ss_clear_screen()
Definition system.cxx:7299
void ss_printf(INT x, INT y, const char *format,...)
Definition system.cxx:7382
INT cm_set_msg_print(INT system_mask, INT user_mask, int(*func)(const char *))
Definition midas.cxx:647
DWORD last_time
Definition mana.cxx:3070
BOOL debug
debug printouts
Definition mana.cxx:254
char host_name[HOST_NAME_LENGTH]
Definition mana.cxx:242
char expt_name[NAME_LENGTH]
Definition mevb.cxx:44
#define HOST_NAME_LENGTH
Definition midas.h:273
#define write(n, a, f, d)
INT open_log_midstat(INT file_mode, INT runn, char *svpath)
Definition mstat.cxx:43
void compose_status(HNDLE hDB, HNDLE hKey)
Definition mstat.cxx:75
#define ESC_FLAG
Definition mstat.cxx:27
Here is the call graph for this function:

◆ open_log_midstat()

INT open_log_midstat ( INT  file_mode,
INT  runn,
char svpath 
)

Definition at line 43 of file mstat.cxx.

44{
45 char srun[32];
47
48 if (file_mode == 1) { /* append run number */
49 strcat(svpath, ".");
50 sprintf(srun, "Run%4.4i", runn);
51 strncat(svpath, srun, 256);
52 printf("output with run file:%s-\n", svpath);
53 }
54 /* open device */
55#ifdef OS_UNIX
56 if ((fHandle = open(svpath, O_WRONLY | O_CREAT | O_TRUNC, 0644)) == -1)
57#endif
58#ifdef OS_OSF1
59 if ((fHandle = open(svpath, O_WRONLY | O_CREAT | O_TRUNC, 0644)) == -1)
60#endif
61#ifdef OS_VXWORKS
62 if ((fHandle = open(svpath, O_WRONLY | O_CREAT | O_TRUNC, 0644)) == -1)
63#endif
64#ifdef OS_WINNT
65 if ((fHandle =
67#endif
68 {
69 printf("File %s cannot be created\n", svpath);
70 }
71 return (fHandle);
72}
#define O_BINARY
Definition msystem.h:219
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ active_flag

BOOL active_flag

Definition at line 38 of file mstat.cxx.

◆ checktime

DWORD checktime

Definition at line 35 of file mstat.cxx.

◆ cur_max_line

INT cur_max_line

Definition at line 39 of file mstat.cxx.

◆ delta_time

DWORD delta_time

Definition at line 35 of file mstat.cxx.

◆ esc_flag

BOOL esc_flag

Definition at line 38 of file mstat.cxx.

◆ hKeychktime

HNDLE hKeychktime

Definition at line 37 of file mstat.cxx.

◆ hKeynlocal

HNDLE hKeynlocal

Definition at line 37 of file mstat.cxx.

◆ lastchecktime

DWORD lastchecktime

Definition at line 35 of file mstat.cxx.

◆ loop

INT loop

Definition at line 39 of file mstat.cxx.

◆ nlocal

INT nlocal

Definition at line 36 of file mstat.cxx.

◆ numprocs

INT numprocs

Definition at line 34 of file mstat.cxx.

◆ rn

INT rn

Definition at line 30 of file mstat.cxx.

◆ xststr

std::string xststr[MAX_LINE]

Definition at line 40 of file mstat.cxx.