Skip to content

Commit

Permalink
c0appz: add -t option to create m0trace.pid file
Browse files Browse the repository at this point in the history
Closes Seagate#4.
  • Loading branch information
andriytk committed Aug 13, 2020
1 parent 860c45e commit 9f36675
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
4 changes: 3 additions & 1 deletion c0appz.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ extern int qos_total_weight; /* total bytes read or written */
extern pthread_mutex_t qos_lock; /* lock qos_total_weight */
enum {MAX_M0_BUFSZ = 128*1024*1024}; /* max bs for object store I/O */
int trace_level=0;
bool m0trace_on = false;

/*
******************************************************************************
Expand Down Expand Up @@ -892,7 +893,8 @@ int c0appz_init(int idx)
fprintf(stderr,"\n---\n");
#endif

m0_trace_set_mmapped_buffer(false);
if (!m0trace_on)
m0_trace_set_mmapped_buffer(false);
/* clovis instance */
rc = m0_clovis_init(&clovis_instance, &clovis_conf, true);
if (rc != 0) {
Expand Down
2 changes: 2 additions & 0 deletions c0appz.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include "clovis/clovis.h"
#include "lib/types.h" /* uint32_t */

extern bool m0trace_on;

int c0appz_init(int idx);
int c0appz_free(void);

Expand Down
6 changes: 5 additions & 1 deletion c0cp.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ options are:\n\
-u | unit size (in KiBs), must be power of 2, >= 4 and <= 4096.\n\
| By default, determined automatically based on the bsz and\n\
| parity configuration of the pool.\n\
-t | create m0trace.pid file\n\
-v | be more verbose\n\
\n\
The -f option forces rewriting on an object if that object already exists. \n\
Expand Down Expand Up @@ -121,7 +122,7 @@ int main(int argc, char **argv)
prog = basename(strdup(argv[0]));

/* getopt */
while((opt = getopt(argc, argv, ":apfc:x:u:v"))!=-1){
while((opt = getopt(argc, argv, ":apfc:x:u:tv"))!=-1){
switch(opt){
case 'a':
m0bs = 1;
Expand All @@ -148,6 +149,9 @@ int main(int argc, char **argv)
if(!isdigit(optarg[0])) pool = -1;
if((pool<0)||(pool>3)) help();
break;
case 't':
m0trace_on = true;
break;
case 'v':
trace_level++;
break;
Expand Down
6 changes: 5 additions & 1 deletion c0ct.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ options are:\n\
-p | performance\n\
-c | contiguous mode. \n\
-c <n> read <n> contiguous copies of the file. \n\
-t | create m0trace.pid file\n\
-v | be more verbose\n\
\n\
The -p option enables performance monitoring. It collects performance stats\n\
Expand Down Expand Up @@ -101,7 +102,7 @@ int main(int argc, char **argv)
prog = basename(strdup(argv[0]));

/* getopt */
while((opt = getopt(argc, argv, ":apc:v"))!=-1){
while((opt = getopt(argc, argv, ":apc:tv"))!=-1){
switch(opt){
case 'a':
m0bs = 1;
Expand All @@ -115,6 +116,9 @@ int main(int argc, char **argv)
if(cont<0) cont=0;
if(!cont) help();
break;
case 't':
m0trace_on = true;
break;
case 'v':
trace_level++;
break;
Expand Down
6 changes: 5 additions & 1 deletion c0rm.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ idl - Mero fid low\n\
option is:\n\
-y | yes\n\
-p | performance\n\
-t | create m0trace.pid file\n\
\n\
The -y option forces deleting an object if that object already exists.\n\
The -p option enables performance monitoring. It collects performance stats\n\
Expand All @@ -72,14 +73,17 @@ int main(int argc, char **argv)
prog = basename(strdup(argv[0]));

/* getopt */
while((opt = getopt(argc, argv, ":py"))!=-1){
while((opt = getopt(argc, argv, ":pyt"))!=-1){
switch(opt){
case 'p':
perf = 1;
break;
case 'y':
yes = 1;
break;
case 't':
m0trace_on = true;
break;
case ':':
fprintf(stderr,"option needs a value\n");
break;
Expand Down

0 comments on commit 9f36675

Please sign in to comment.