trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject [trafficserver] 02/09: Add records configuration support to traffic_top.
Date Fri, 12 Jan 2018 16:03:43 GMT
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit fe826e7c51c633f6fce4d9704759e38a74b94f3c
Author: James Peach <jpeach@apache.org>
AuthorDate: Fri Jun 9 21:26:08 2017 -0700

    Add records configuration support to traffic_top.
    
    (cherry picked from commit 9cc421218921b322fbadf085cc3ccd2b9a9fff4f)
    
     Conflicts:
    	cmd/traffic_top/traffic_top.cc
---
 cmd/traffic_top/Makefile.am    |  6 ++++++
 cmd/traffic_top/traffic_top.cc | 23 ++++++++++++++++++-----
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/cmd/traffic_top/Makefile.am b/cmd/traffic_top/Makefile.am
index d9c66ba..f9079b1 100644
--- a/cmd/traffic_top/Makefile.am
+++ b/cmd/traffic_top/Makefile.am
@@ -21,6 +21,8 @@ if BUILD_TRAFFIC_TOP
 AM_CPPFLAGS += \
   $(iocore_include_dirs) \
   -I$(abs_top_srcdir)/lib \
+  -I$(abs_top_srcdir)/lib/records \
+  -I$(abs_top_srcdir)/mgmt \
   -I$(abs_top_srcdir)/mgmt/api/include \
   @CURL_CFLAGS@ \
   @CURSES_CFLAGS@
@@ -33,6 +35,10 @@ bin_PROGRAMS = traffic_top
 traffic_top_SOURCES = traffic_top.cc
 
 traffic_top_LDADD = \
+  $(top_builddir)/lib/records/librecords_p.a \
+  $(top_builddir)/mgmt/libmgmt_p.la \
+  $(top_builddir)/iocore/eventsystem/libinkevent.a \
+  $(top_builddir)/proxy/shared/libUglyLogStubs.a \
   $(top_builddir)/mgmt/api/libtsmgmt.la \
   $(top_builddir)/lib/ts/libtsutil.la \
   @CURL_LIBS@ \
diff --git a/cmd/traffic_top/traffic_top.cc b/cmd/traffic_top/traffic_top.cc
index 16ad488..ad289fe 100644
--- a/cmd/traffic_top/traffic_top.cc
+++ b/cmd/traffic_top/traffic_top.cc
@@ -54,11 +54,11 @@
 #include "stats.h"
 
 #include "ts/I_Layout.h"
-#include "ts/ink_args.h"
 #include "I_RecProcess.h"
 #include "RecordsConfig.h"
 
 using namespace std;
+
 #if HAS_CURL
 char curl_error[CURL_ERROR_SIZE];
 #endif
@@ -423,16 +423,29 @@ main(int argc, const char **argv)
     break;
   }
 
-  case 1:
+  Layout::create();
+  RecProcessInit(RECM_STAND_ALONE, nullptr /* diags */);
+  LibRecordsConfigInit();
+
+  string url = "";
 #if HAS_CURL
     url = file_arguments[0];
 #else
     usage(argument_descriptions, countof(argument_descriptions), USAGE);
 #endif
-    break;
 
-  default:
-    usage(argument_descriptions, countof(argument_descriptions), USAGE);
+    ats_scoped_str rundir(RecConfigReadRuntimeDir());
+
+    if (TS_ERR_OKAY != TSInit(rundir, static_cast<TSInitOptionT>(TS_MGMT_OPT_NO_EVENTS
| TS_MGMT_OPT_NO_SOCK_TESTS))) {
+#if HAS_CURL
+      fprintf(stderr, "Error: missing URL on command line or error connecting to the local
manager\n");
+#else
+      fprintf(stderr, "Error: error connecting to the local manager\n");
+#endif
+      usage();
+    }
+  } else {
+    url = argv[optind];
   }
 
   Stats stats(url);

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.

Mime
View raw message