You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2013/04/01 19:15:01 UTC

git commit: TS-1766: integrate AIO test into the autotools test suite

Updated Branches:
  refs/heads/master 4aa69fb35 -> 3116860ed


TS-1766: integrate AIO test into the autotools test suite

  - Add some const to Diags tags API.
  - Use _SOURCES rather than _LDADD to build source files.
  - Remove unused macro MGMT_PTR.
  - Remove ProcessManager usage of global_config_cbs global to
    reduce the number of global dependencies.
  - Add AIO unit test to the build.
  - Move AIO tests into a single file.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/3116860e
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/3116860e
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/3116860e

Branch: refs/heads/master
Commit: 3116860ed11f52a4fa7b38037caece9f39262a36
Parents: 4aa69fb
Author: James Peach <jp...@apache.org>
Authored: Mon Mar 25 14:41:35 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Mon Apr 1 10:14:16 2013 -0700

----------------------------------------------------------------------
 CHANGES                    |    2 +
 ci/regression              |    2 +-
 iocore/aio/Makefile.am     |   26 ++
 iocore/aio/test_AIO.cc     |  522 ++++++++++++++++++++++++++++++++++++++
 iocore/aio/test_AIO.i      |  527 ---------------------------------------
 iocore/aio/test_AIO.sample |    2 +
 iocore/aio/test_I_AIO.cc   |   25 --
 iocore/aio/test_P_AIO.cc   |   25 --
 lib/ts/Diags.cc            |   13 +-
 lib/ts/Diags.h             |    8 +-
 mgmt/ProcessManager.cc     |    4 +-
 mgmt/ProcessManager.h      |   19 +-
 proxy/DiagsConfig.cc       |    2 -
 proxy/Main.cc              |    2 +
 proxy/Makefile.am          |   84 ++++---
 15 files changed, 621 insertions(+), 642 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3116860e/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 650d602..3e2838c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,8 @@
   Changes with Apache Traffic Server 3.3.2
 
 
+  *) [TS-1766] integrate AIO test into the autotools test suite
+
   *) [TS-1753] Add remap support to the cacheurl plugin
    Author: Mark Harrison <ma...@mivok.net>
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3116860e/ci/regression
----------------------------------------------------------------------
diff --git a/ci/regression b/ci/regression
index 5085dea..8fd985d 100755
--- a/ci/regression
+++ b/ci/regression
@@ -98,7 +98,7 @@ build() {
 }
 
 regress() {
-  ( cd $OBJROOT && $MAKE check )
+  ( cd $OBJROOT && $MAKE check ) && \
   $DSTROOT/bin/traffic_server -R 1
 }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3116860e/iocore/aio/Makefile.am
----------------------------------------------------------------------
diff --git a/iocore/aio/Makefile.am b/iocore/aio/Makefile.am
index 54da3ee..4090184 100644
--- a/iocore/aio/Makefile.am
+++ b/iocore/aio/Makefile.am
@@ -23,8 +23,34 @@ AM_CPPFLAGS = \
   -I$(top_srcdir)/lib/ts
 
 DEFS += @IOCORE_MODULARIZED_DEFS@
+TESTS = test_AIO.sample
 
 noinst_LIBRARIES = libinkaio.a
+check_PROGRAMS = test_AIO
 
 libinkaio_a_SOURCES = AIO.cc I_AIO.h P_AIO.h Inline.cc
+test_AIO_SOURCES = \
+  test_AIO.cc \
+  ../../proxy/UglyLogStubs.cc
+
+test_AIO_CXXFLAGS = \
+  $(iocore_include_dirs) \
+  -I$(top_builddir)/proxy \
+  -I$(top_builddir)/proxy/api/ts \
+  -I$(top_srcdir)/proxy/api \
+  -I$(top_srcdir)/proxy \
+  -I$(top_srcdir)/proxy/hdrs \
+  -I$(top_srcdir)/proxy/http \
+  -I$(top_srcdir)/proxy/logging \
+  -I$(top_srcdir)/mgmt \
+  -I$(top_srcdir)/mgmt/utils
+
+test_AIO_LDADD = \
+  libinkaio.a \
+  $(top_builddir)/lib/records/librecprocess.a \
+  $(top_builddir)/mgmt/libmgmt_p.a \
+  $(top_builddir)/mgmt/utils/libutils_p.a \
+  $(top_builddir)/iocore/eventsystem/libinkevent.a \
+  $(top_builddir)/lib/ts/libtsutil.la \
+  @LIBTCL@
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3116860e/iocore/aio/test_AIO.cc
----------------------------------------------------------------------
diff --git a/iocore/aio/test_AIO.cc b/iocore/aio/test_AIO.cc
new file mode 100644
index 0000000..21b2b69
--- /dev/null
+++ b/iocore/aio/test_AIO.cc
@@ -0,0 +1,522 @@
+/** @file
+
+  A brief file description
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "P_AIO.h"
+#include "InkAPIInternal.h"
+#include "I_Layout.h"
+#include <iostream>
+#include <fstream>
+
+using std::cout;
+using std::endl;
+
+Diags *diags;
+int diags_init = 0;
+#define DIAGS_LOG_FILE "diags.log"
+
+void syslog_thr_init(void)
+{
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//      void reconfigure_diags()
+//
+//      This function extracts the current diags configuration settings from
+//      records.config, and rebuilds the Diags data structures.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+static void
+reconfigure_diags()
+{
+  int i;
+  DiagsConfigState c;
+
+  // initial value set to 0 or 1 based on command line tags
+  c.enabled[DiagsTagType_Debug] = (diags->base_debug_tags != NULL);
+  c.enabled[DiagsTagType_Action] = (diags->base_action_tags != NULL);
+
+  c.enabled[DiagsTagType_Debug] = 1;
+  c.enabled[DiagsTagType_Action] = 1;
+  diags->show_location = 1;
+
+  // read output routing values
+  for (i = 0; i < DiagsLevel_Count; i++) {
+
+    c.outputs[i].to_stdout = 0;
+    c.outputs[i].to_stderr = 1;
+    c.outputs[i].to_syslog = 1;
+    c.outputs[i].to_diagslog = 1;
+  }
+
+  //////////////////////////////
+  // clear out old tag tables //
+  //////////////////////////////
+
+  diags->deactivate_all(DiagsTagType_Debug);
+  diags->deactivate_all(DiagsTagType_Action);
+
+  //////////////////////////////////////////////////////////////////////
+  //                     add new tag tables
+  //////////////////////////////////////////////////////////////////////
+
+  if (diags->base_debug_tags)
+    diags->activate_taglist(diags->base_debug_tags, DiagsTagType_Debug);
+  if (diags->base_action_tags)
+    diags->activate_taglist(diags->base_action_tags, DiagsTagType_Action);
+
+  ////////////////////////////////////
+  // change the diags config values //
+  ////////////////////////////////////
+#if !defined(__GNUC__) && !defined(hpux)
+  diags->config = c;
+#else
+  memcpy(((void *) &diags->config), ((void *) &c), sizeof(DiagsConfigState));
+#endif
+
+}
+
+static void
+init_diags(const char *bdt, const char *bat)
+{
+  FILE *diags_log_fp;
+  char diags_logpath[500];
+  strcpy(diags_logpath, DIAGS_LOG_FILE);
+
+  diags_log_fp = fopen(diags_logpath, "w");
+  if (diags_log_fp) {
+    int status;
+    status = setvbuf(diags_log_fp, NULL, _IOLBF, 512);
+    if (status != 0) {
+      fclose(diags_log_fp);
+      diags_log_fp = NULL;
+    }
+  }
+
+  diags = NEW(new Diags(bdt, bat, diags_log_fp));
+
+  if (diags_log_fp == NULL) {
+    Warning("couldn't open diags log file '%s', " "will not log to this file", diags_logpath);
+  }
+
+  Status("opened %s", diags_logpath);
+  reconfigure_diags();
+
+}
+
+#define MAX_DISK_THREADS 200
+#ifdef DISK_ALIGN
+#define MIN_OFFSET       (32*1024)
+#else
+#define MIN_OFFSET       (8*1024)
+#endif
+enum
+{ READ_MODE, WRITE_MODE, RANDOM_READ_MODE };
+
+struct AIO_Device;
+volatile int n_accessors = 0;
+int orig_n_accessors;
+AIO_Device *dev[MAX_DISK_THREADS];
+
+extern RecInt cache_config_threads_per_disk;
+
+int write_after = 0;
+int write_skip = 0;
+int hotset_size = 20;
+double hotset_frequency = 0.9;
+int touch_data = 0;
+int disk_size = 4000;
+int read_size = 1024;
+char *disk_path[MAX_DISK_THREADS];
+int n_disk_path = 0;
+int run_time = 0;
+int threads_per_disk = 1;
+int delete_disks = 0;
+int max_size = 0;
+int use_lseek = 0;
+
+int chains = 1;
+double seq_read_percent = 0.0;
+double seq_write_percent = 0.0;
+double rand_read_percent = 0.0;
+double real_seq_read_percent = 0.0;
+double real_seq_write_percent = 0.0;
+double real_rand_read_percent = 0.0;
+int seq_read_size = 0;
+int seq_write_size = 0;
+int rand_read_size = 0;
+
+struct AIO_Device:public Continuation
+{
+  char *path;
+  int fd;
+  int id;
+  char *buf;
+  ink_hrtime time_start, time_end;
+  int seq_reads;
+  int seq_writes;
+  int rand_reads;
+  int hotset_idx;
+  int mode;
+  AIOCallback *io;
+    AIO_Device(ProxyMutex * m):Continuation(m)
+  {
+    hotset_idx = 0;
+    io = new_AIOCallback();
+    time_start = 0;
+    SET_HANDLER(&AIO_Device::do_hotset);
+  }
+  int select_mode(double p)
+  {
+    if (p < real_seq_read_percent)
+      return READ_MODE;
+    else if (p < real_seq_read_percent + real_seq_write_percent)
+      return WRITE_MODE;
+    else
+      return RANDOM_READ_MODE;
+  };
+  void do_touch_data(off_t orig_len, off_t orig_offset)
+  {
+    if (!touch_data)
+      return;
+    unsigned int len = (unsigned int) orig_len;
+    unsigned int offset = (unsigned int) orig_offset;
+    offset = offset % 1024;
+    char *b = buf;
+    unsigned *x = (unsigned *) b;
+    for (unsigned j = 0; j < (len / sizeof(int)); j++) {
+      x[j] = offset;
+      offset = (offset + 1) % 1024;
+    }
+  };
+  int do_check_data(off_t orig_len, off_t orig_offset)
+  {
+    if (!touch_data)
+      return 0;
+    unsigned int len = (unsigned int) orig_len;
+    unsigned int offset = (unsigned int) orig_offset;
+    offset = offset % 1024;
+    unsigned *x = (unsigned *) buf;
+    for (unsigned j = 0; j < (len / sizeof(int)); j++) {
+      if (x[j] != offset)
+        return 1;
+      offset = (offset + 1) % 1024;
+    }
+    return 0;
+  }
+  int do_hotset(int event, Event * e);
+  int do_fd(int event, Event * e);
+
+};
+
+void
+dump_summary(void)
+{
+  /* dump timing info */
+  printf("Writing summary info\n");
+
+  printf("----------\n");
+  printf("parameters\n");
+  printf("----------\n");
+  printf("%d disks\n", n_disk_path);
+  printf("%d chains\n", chains);
+  printf("%d threads_per_disk\n", threads_per_disk);
+
+  printf("%0.1f percent %d byte seq_reads by volume\n", seq_read_percent * 100.0, seq_read_size);
+  printf("%0.1f percent %d byte seq_writes by volume\n", seq_write_percent * 100.0, seq_write_size);
+  printf("%0.1f percent %d byte rand_reads by volume\n", rand_read_percent * 100.0, rand_read_size);
+  printf("-------\n");
+  printf("factors\n");
+  printf("-------\n");
+  printf("%0.1f percent %d byte seq_reads by count\n", real_seq_read_percent * 100.0, seq_read_size);
+  printf("%0.1f percent %d byte seq_writes by count\n", real_seq_write_percent * 100.0, seq_write_size);
+  printf("%0.1f percent %d byte rand_reads by count\n", real_rand_read_percent * 100.0, rand_read_size);
+
+  printf("-------------------------\n");
+  printf("individual thread results\n");
+  printf("-------------------------\n");
+  double total_seq_reads = 0;
+  double total_seq_writes = 0;
+  double total_rand_reads = 0;
+  double total_secs = 0.0;
+  for (int i = 0; i < orig_n_accessors; i++) {
+    double secs = (dev[i]->time_end - dev[i]->time_start) / 1000000000.0;
+    double ops_sec = (dev[i]->seq_reads + dev[i]->seq_writes + dev[i]->rand_reads) / secs;
+    printf("%s: #sr:%d #sw:%d #rr:%d %0.1f secs %0.1f ops/sec\n",
+           dev[i]->path, dev[i]->seq_reads, dev[i]->seq_writes, dev[i]->rand_reads, secs, ops_sec);
+    total_secs += secs;
+    total_seq_reads += dev[i]->seq_reads;
+    total_seq_writes += dev[i]->seq_writes;
+    total_rand_reads += dev[i]->rand_reads;
+  }
+  printf("-----------------\n");
+  printf("aggregate results\n");
+  printf("-----------------\n");
+  total_secs /= orig_n_accessors;
+  float sr = (total_seq_reads * seq_read_size) / total_secs;
+  sr /= 1024.0 * 1024.0;
+  float sw = (total_seq_writes * seq_write_size) / total_secs;
+  sw /= 1024.0 * 1024.0;
+  float rr = (total_rand_reads * rand_read_size) / total_secs;
+  rr /= 1024.0 * 1024.0;
+  printf("%f ops %0.2f mbytes/sec %0.1f ops/sec %0.1f ops/sec/disk seq_read\n",
+         total_seq_reads, sr, total_seq_reads / total_secs, total_seq_reads / total_secs / n_disk_path);
+  printf("%f ops %0.2f mbytes/sec %0.1f ops/sec %0.1f ops/sec/disk seq_write\n",
+         total_seq_writes, sw, total_seq_writes / total_secs, total_seq_writes / total_secs / n_disk_path);
+  printf("%f ops %0.2f mbytes/sec %0.1f ops/sec %0.1f ops/sec/disk rand_read\n",
+         total_rand_reads, rr, total_rand_reads / total_secs, total_rand_reads / total_secs / n_disk_path);
+  printf("%0.2f total mbytes/sec\n", sr + sw + rr);
+  printf("----------------------------------------------------------\n");
+
+  if (delete_disks)
+    for (int i = 0; i < n_disk_path; i++)
+      unlink(disk_path[i]);
+  exit(0);
+}
+
+int
+AIO_Device::do_hotset(int event, Event * e)
+{
+  off_t max_offset = ((off_t) disk_size) * 1024 * 1024;
+  io->aiocb.aio_lio_opcode = LIO_WRITE;
+  io->aiocb.aio_fildes = fd;
+  io->aiocb.aio_offset = MIN_OFFSET + hotset_idx * max_size;
+  do_touch_data(seq_read_size, io->aiocb.aio_offset);
+  ink_assert(!do_check_data(seq_read_size, io->aiocb.aio_offset));
+  if (!hotset_idx)
+    fprintf(stderr, "Starting hotset document writing \n");
+  if (io->aiocb.aio_offset > max_offset) {
+    fprintf(stderr,
+            "Finished hotset documents  [%d] offset [%6.0f] size [%6.0f]\n",
+            hotset_idx, (float) MIN_OFFSET, (float) max_size);
+    SET_HANDLER(&AIO_Device::do_fd);
+    eventProcessor.schedule_imm(this);
+    return (0);
+  }
+  io->aiocb.aio_nbytes = seq_read_size;
+  io->aiocb.aio_buf = buf;
+  io->action = this;
+  io->thread = mutex->thread_holding;
+  ink_assert(ink_aio_write(io) >= 0);
+  hotset_idx++;
+  return 0;
+}
+
+int
+AIO_Device::do_fd(int event, Event * e)
+{
+  if (!time_start) {
+    time_start = ink_get_hrtime();
+    fprintf(stderr, "Starting the aio_testing \n");
+  }
+  if ((ink_get_hrtime() - time_start) > (run_time * HRTIME_SECOND)) {
+    time_end = ink_get_hrtime();
+    ink_atomic_increment(&n_accessors, -1);
+    if (n_accessors <= 0)
+      dump_summary();
+    return 0;
+  }
+
+  off_t max_offset = ((off_t) disk_size) * 1024 * 1024; // MB-GB
+  off_t max_hotset_offset = ((off_t) hotset_size) * 1024 * 1024;        // MB-GB
+  off_t seq_read_point = ((off_t) MIN_OFFSET);
+  off_t seq_write_point = ((off_t) MIN_OFFSET) + max_offset / 2 + write_after * 1024 * 1024;
+  seq_write_point += (id % n_disk_path) * (max_offset / (threads_per_disk * 4));
+  if (seq_write_point > max_offset)
+    seq_write_point = MIN_OFFSET;
+
+  if (io->aiocb.aio_lio_opcode == LIO_READ) {
+    ink_assert(!do_check_data(io->aiocb.aio_nbytes, io->aiocb.aio_offset));
+  }
+  memset((void *) buf, 0, max_size);
+  io->aiocb.aio_fildes = fd;
+  io->aiocb.aio_buf = buf;
+  io->action = this;
+  io->thread = mutex->thread_holding;
+
+  switch (select_mode(drand48())) {
+  case READ_MODE:
+    io->aiocb.aio_offset = seq_read_point;
+    io->aiocb.aio_nbytes = seq_read_size;
+    io->aiocb.aio_lio_opcode = LIO_READ;
+    ink_assert(ink_aio_read(io) >= 0);
+    seq_read_point += seq_read_size;
+    if (seq_read_point > max_offset)
+      seq_read_point = MIN_OFFSET;
+    seq_reads++;
+    break;
+  case WRITE_MODE:
+    io->aiocb.aio_offset = seq_write_point;
+    io->aiocb.aio_nbytes = seq_write_size;
+    io->aiocb.aio_lio_opcode = LIO_WRITE;
+    do_touch_data(seq_write_size, ((int) seq_write_point) % 1024);
+    ink_assert(ink_aio_write(io) >= 0);
+    seq_write_point += seq_write_size;
+    seq_write_point += write_skip;
+    if (seq_write_point > max_offset)
+      seq_write_point = MIN_OFFSET;
+
+    seq_writes++;
+    break;
+  case RANDOM_READ_MODE:{
+      // fprintf(stderr, "random read started \n");
+      double p, f;
+      p = drand48();
+      f = drand48();
+      off_t o = 0;
+      if (f < hotset_frequency)
+        o = (off_t) p *max_hotset_offset;
+      else
+        o = (off_t) p *(max_offset - rand_read_size);
+      if (o < MIN_OFFSET)
+        o = MIN_OFFSET;
+      o = (o + (seq_read_size - 1)) & (~(seq_read_size - 1));
+      io->aiocb.aio_offset = o;
+      io->aiocb.aio_nbytes = rand_read_size;
+      io->aiocb.aio_lio_opcode = LIO_READ;
+      ink_assert(ink_aio_read(io) >= 0);
+      rand_reads++;
+      break;
+    }
+  }
+  return 0;
+}
+
+#define PARAM(_s) \
+        else if (strcmp(field_name, #_s) == 0) { \
+            fin >> _s; \
+            cout << "reading " #_s " = "  \
+                 << _s << endl; \
+				  }
+
+int
+read_config(const char *config_filename)
+{
+  std::ifstream fin(config_filename);
+  char field_name[256];
+  char field_value[256];
+
+  if (!fin.rdbuf()->is_open()) {
+    fin.open("sample.cfg");
+    if (!fin.rdbuf()->is_open()) {
+      cout << "cannot open config files " << config_filename << endl;
+      return (0);
+    }
+  }
+  while (!fin.eof()) {
+    field_name[0] = '\0';
+    fin >> field_name;
+    if (0) {
+    }
+    PARAM(hotset_size)
+      PARAM(hotset_frequency)
+      PARAM(touch_data)
+      PARAM(use_lseek)
+      PARAM(write_after)
+      PARAM(write_skip)
+      PARAM(disk_size)
+      PARAM(seq_read_percent)
+      PARAM(seq_write_percent)
+      PARAM(rand_read_percent)
+      PARAM(seq_read_size)
+      PARAM(seq_write_size)
+      PARAM(rand_read_size)
+      PARAM(run_time)
+      PARAM(chains)
+      PARAM(threads_per_disk)
+      PARAM(delete_disks)
+      else if (strcmp(field_name, "disk_path") == 0) {
+      assert(n_disk_path < MAX_DISK_THREADS);
+      fin >> field_value;
+      disk_path[n_disk_path] = strdup(field_value);
+      cout << "reading disk_path = " << disk_path[n_disk_path] << endl;
+      n_disk_path++;
+    }
+  }
+  assert(read_size > 0);
+  int t = seq_read_size + seq_write_size + rand_read_size;
+  real_seq_read_percent = seq_read_percent;
+  real_seq_write_percent = seq_write_percent;
+  real_rand_read_percent = rand_read_percent;
+  if (seq_read_size)
+    real_seq_read_percent *= t / seq_read_size;
+  if (seq_write_size)
+    real_seq_write_percent *= t / seq_write_size;
+  if (rand_read_size)
+    real_rand_read_percent *= t / rand_read_size;
+  float tt = real_seq_read_percent + real_seq_write_percent + real_rand_read_percent;
+  real_seq_read_percent = real_seq_read_percent / tt;
+  real_seq_write_percent = real_seq_write_percent / tt;
+  real_rand_read_percent = real_rand_read_percent / tt;
+  return (1);
+}
+
+int
+main(int argc, char *argv[])
+{
+  int i;
+
+  Layout::create();
+  init_diags("", NULL);
+  RecProcessInit(RECM_STAND_ALONE);
+  ink_event_system_init(EVENT_SYSTEM_MODULE_VERSION);
+  eventProcessor.start(ink_number_of_processors());
+  RecProcessStart();
+  ink_aio_init(AIO_MODULE_VERSION);
+  srand48(time(NULL));
+
+  if (!read_config(argv[1]))
+    exit(1);
+
+  max_size = seq_read_size;
+  if (seq_write_size > max_size)
+    max_size = seq_write_size;
+  if (rand_read_size > max_size)
+    max_size = rand_read_size;
+
+  cache_config_threads_per_disk = threads_per_disk;
+  orig_n_accessors = n_disk_path * threads_per_disk;
+
+  for (i = 0; i < n_disk_path; i++) {
+    for (int j = 0; j < threads_per_disk; j++) {
+      dev[n_accessors] = new AIO_Device(new_ProxyMutex());
+      dev[n_accessors]->id = i * threads_per_disk + j;
+      dev[n_accessors]->path = disk_path[i];
+      dev[n_accessors]->seq_reads = 0;
+      dev[n_accessors]->seq_writes = 0;
+      dev[n_accessors]->rand_reads = 0;
+      dev[n_accessors]->fd = open(dev[n_accessors]->path, O_RDWR | O_CREAT, 0600);
+      fchmod(dev[n_accessors]->fd, S_IRWXU | S_IRWXG);
+      if (dev[n_accessors]->fd < 0) {
+        perror(disk_path[i]);
+        exit(1);
+      }
+      dev[n_accessors]->buf = (char *) valloc(max_size);
+      eventProcessor.schedule_imm(dev[n_accessors]);
+      n_accessors++;
+    }
+  }
+
+  this_thread()->execute();
+}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3116860e/iocore/aio/test_AIO.i
----------------------------------------------------------------------
diff --git a/iocore/aio/test_AIO.i b/iocore/aio/test_AIO.i
deleted file mode 100644
index a02f1e0..0000000
--- a/iocore/aio/test_AIO.i
+++ /dev/null
@@ -1,527 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#include <iostream.h>
-#include <fstream.h>
-
-Diags *diags;
-#define DIAGS_LOG_FILE "diags.log"
-
-//////////////////////////////////////////////////////////////////////////////
-//
-//      void reconfigure_diags()
-//
-//      This function extracts the current diags configuration settings from
-//      records.config, and rebuilds the Diags data structures.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-static void
-reconfigure_diags()
-{
-  int i;
-  DiagsConfigState c;
-
-
-  // initial value set to 0 or 1 based on command line tags
-  c.enabled[DiagsTagType_Debug] = (diags->base_debug_tags != NULL);
-  c.enabled[DiagsTagType_Action] = (diags->base_action_tags != NULL);
-
-  c.enabled[DiagsTagType_Debug] = 1;
-  c.enabled[DiagsTagType_Action] = 1;
-  diags->show_location = 1;
-
-
-  // read output routing values
-  for (i = 0; i < DiagsLevel_Count; i++) {
-
-    c.outputs[i].to_stdout = 0;
-    c.outputs[i].to_stderr = 1;
-    c.outputs[i].to_syslog = 1;
-    c.outputs[i].to_diagslog = 1;
-  }
-
-  //////////////////////////////
-  // clear out old tag tables //
-  //////////////////////////////
-
-  diags->deactivate_all(DiagsTagType_Debug);
-  diags->deactivate_all(DiagsTagType_Action);
-
-  //////////////////////////////////////////////////////////////////////
-  //                     add new tag tables 
-  //////////////////////////////////////////////////////////////////////
-
-  if (diags->base_debug_tags)
-    diags->activate_taglist(diags->base_debug_tags, DiagsTagType_Debug);
-  if (diags->base_action_tags)
-    diags->activate_taglist(diags->base_action_tags, DiagsTagType_Action);
-
-  ////////////////////////////////////
-  // change the diags config values //
-  ////////////////////////////////////
-#if !defined(__GNUC__) && !defined(hpux)
-  diags->config = c;
-#else
-  memcpy(((void *) &diags->config), ((void *) &c), sizeof(DiagsConfigState));
-#endif
-
-}
-
-
-
-static void
-init_diags(char *bdt, char *bat)
-{
-  FILE *diags_log_fp;
-  char diags_logpath[500];
-  strcpy(diags_logpath, DIAGS_LOG_FILE);
-
-  diags_log_fp = fopen(diags_logpath, "w");
-  if (diags_log_fp) {
-    int status;
-    status = setvbuf(diags_log_fp, NULL, _IOLBF, 512);
-    if (status != 0) {
-      fclose(diags_log_fp);
-      diags_log_fp = NULL;
-    }
-  }
-
-  diags = NEW(new Diags(bdt, bat, diags_log_fp));
-
-  if (diags_log_fp == NULL) {
-    SrcLoc loc(__FILE__, __FUNCTION__, __LINE__);
-
-    diags->print(NULL, DL_Warning, NULL, &loc,
-                 "couldn't open diags log file '%s', " "will not log to this file", diags_logpath);
-  }
-
-  diags->print(NULL, DL_Status, "STATUS", NULL, "opened %s", diags_logpath);
-  reconfigure_diags();
-
-}
-
-#define MAX_DISK_THREADS 200
-#ifdef DISK_ALIGN
-#define MIN_OFFSET       (32*1024)
-#else
-#define MIN_OFFSET       (8*1024)
-#endif
-enum
-{ READ_MODE, WRITE_MODE, RANDOM_READ_MODE };
-
-struct AIO_Device;
-volatile int n_accessors = 0;
-int orig_n_accessors;
-AIO_Device *dev[MAX_DISK_THREADS];
-
-extern int cache_config_threads_per_disk;
-
-
-int write_after = 0;
-int write_skip = 0;
-int hotset_size = 20;
-double hotset_frequency = 0.9;
-int touch_data = 0;
-int disk_size = 4000;
-int read_size = 1024;
-char *disk_path[MAX_DISK_THREADS];
-int n_disk_path = 0;
-int run_time = 0;
-int threads_per_disk = 1;
-int delete_disks = 0;
-int max_size = 0;
-int use_lseek = 0;
-
-int chains = 1;
-double seq_read_percent = 0.0;
-double seq_write_percent = 0.0;
-double rand_read_percent = 0.0;
-double real_seq_read_percent = 0.0;
-double real_seq_write_percent = 0.0;
-double real_rand_read_percent = 0.0;
-int seq_read_size = 0;
-int seq_write_size = 0;
-int rand_read_size = 0;
-
-struct AIO_Device:public Continuation
-{
-  char *path;
-  int fd;
-  int id;
-  char *buf;
-  ink_hrtime time_start, time_end;
-  int seq_reads;
-  int seq_writes;
-  int rand_reads;
-  int hotset_idx;
-  int mode;
-  AIOCallback *io;
-    AIO_Device(ProxyMutex * m):Continuation(m)
-  {
-    hotset_idx = 0;
-    io = new_AIOCallback();
-    time_start = 0;
-    SET_HANDLER(&AIO_Device::do_hotset);
-  }
-  int select_mode(double p)
-  {
-    if (p < real_seq_read_percent)
-      return READ_MODE;
-    else if (p < real_seq_read_percent + real_seq_write_percent)
-      return WRITE_MODE;
-    else
-      return RANDOM_READ_MODE;
-  };
-  void do_touch_data(ink_off_t orig_len, ink_off_t orig_offset)
-  {
-    if (!touch_data)
-      return;
-    unsigned int len = (unsigned int) orig_len;
-    unsigned int offset = (unsigned int) orig_offset;
-    offset = offset % 1024;
-    char *b = buf;
-    int *x = (int *) b;
-    int j;
-    for (j = 0; j < (int) (len / sizeof(int)); j++) {
-      x[j] = offset;
-      offset = (offset + 1) % 1024;
-    }
-  };
-  int do_check_data(ink_off_t orig_len, ink_off_t orig_offset)
-  {
-    if (!touch_data)
-      return 0;
-    unsigned int len = (unsigned int) orig_len;
-    unsigned int offset = (unsigned int) orig_offset;
-    offset = offset % 1024;
-    int *x = (int *) buf;
-    for (int j = 0; j < (int) (len / sizeof(int)); j++) {
-      if (x[j] != offset)
-        return 1;
-      offset = (offset + 1) % 1024;
-    }
-    return 0;
-  }
-  int do_hotset(int event, Event * e);
-  int do_fd(int event, Event * e);
-
-
-};
-
-
-
-
-void
-dump_summary(void)
-{
-  /* dump timing info */
-  printf("Writing summary info\n");
-
-  printf("----------\n");
-  printf("parameters\n");
-  printf("----------\n");
-  printf("%d disks\n", n_disk_path);
-  printf("%d chains\n", chains);
-  printf("%d threads_per_disk\n", threads_per_disk);
-
-  printf("%0.1f percent %d byte seq_reads by volume\n", seq_read_percent * 100.0, seq_read_size);
-  printf("%0.1f percent %d byte seq_writes by volume\n", seq_write_percent * 100.0, seq_write_size);
-  printf("%0.1f percent %d byte rand_reads by volume\n", rand_read_percent * 100.0, rand_read_size);
-  printf("-------\n");
-  printf("factors\n");
-  printf("-------\n");
-  printf("%0.1f percent %d byte seq_reads by count\n", real_seq_read_percent * 100.0, seq_read_size);
-  printf("%0.1f percent %d byte seq_writes by count\n", real_seq_write_percent * 100.0, seq_write_size);
-  printf("%0.1f percent %d byte rand_reads by count\n", real_rand_read_percent * 100.0, rand_read_size);
-
-  printf("-------------------------\n");
-  printf("individual thread results\n");
-  printf("-------------------------\n");
-  double total_seq_reads = 0;
-  double total_seq_writes = 0;
-  double total_rand_reads = 0;
-  double total_secs = 0.0;
-  for (int i = 0; i < orig_n_accessors; i++) {
-    double secs = (dev[i]->time_end - dev[i]->time_start) / 1000000000.0;
-    double ops_sec = (dev[i]->seq_reads + dev[i]->seq_writes + dev[i]->rand_reads) / secs;
-    printf("%s: #sr:%d #sw:%d #rr:%d %0.1f secs %0.1f ops/sec\n",
-           dev[i]->path, dev[i]->seq_reads, dev[i]->seq_writes, dev[i]->rand_reads, secs, ops_sec);
-    total_secs += secs;
-    total_seq_reads += dev[i]->seq_reads;
-    total_seq_writes += dev[i]->seq_writes;
-    total_rand_reads += dev[i]->rand_reads;
-  }
-  printf("-----------------\n");
-  printf("aggregate results\n");
-  printf("-----------------\n");
-  total_secs /= orig_n_accessors;
-  float sr = (total_seq_reads * seq_read_size) / total_secs;
-  sr /= 1024.0 * 1024.0;
-  float sw = (total_seq_writes * seq_write_size) / total_secs;
-  sw /= 1024.0 * 1024.0;
-  float rr = (total_rand_reads * rand_read_size) / total_secs;
-  rr /= 1024.0 * 1024.0;
-  printf("%f ops %0.2f mbytes/sec %0.1f ops/sec %0.1f ops/sec/disk seq_read\n",
-         total_seq_reads, sr, total_seq_reads / total_secs, total_seq_reads / total_secs / n_disk_path);
-  printf("%f ops %0.2f mbytes/sec %0.1f ops/sec %0.1f ops/sec/disk seq_write\n",
-         total_seq_writes, sw, total_seq_writes / total_secs, total_seq_writes / total_secs / n_disk_path);
-  printf("%f ops %0.2f mbytes/sec %0.1f ops/sec %0.1f ops/sec/disk rand_read\n",
-         total_rand_reads, rr, total_rand_reads / total_secs, total_rand_reads / total_secs / n_disk_path);
-  printf("%0.2f total mbytes/sec\n", sr + sw + rr);
-  printf("----------------------------------------------------------\n");
-
-  if (delete_disks)
-    for (int i = 0; i < n_disk_path; i++)
-      unlink(disk_path[i]);
-  exit(0);
-}
-
-int
-AIO_Device::do_hotset(int event, Event * e)
-{
-  ink_off_t max_offset = ((ink_off_t) disk_size) * 1024 * 1024;
-  io->aiocb.aio_lio_opcode = LIO_WRITE;
-  io->aiocb.aio_fildes = fd;
-  io->aiocb.aio_offset = MIN_OFFSET + hotset_idx * max_size;
-  do_touch_data(seq_read_size, io->aiocb.aio_offset);
-  ink_assert(!do_check_data(seq_read_size, io->aiocb.aio_offset));
-  if (!hotset_idx)
-    fprintf(stderr, "Starting hotset document writing \n");
-  if (io->aiocb.aio_offset > max_offset) {
-    fprintf(stderr,
-            "Finished hotset documents  [%d] offset [%6.0f] size [%6.0f]\n",
-            hotset_idx, (float) MIN_OFFSET, (float) max_size);
-    SET_HANDLER(&AIO_Device::do_fd);
-    eventProcessor.schedule_imm(this);
-    return (0);
-  }
-  io->aiocb.aio_nbytes = seq_read_size;
-  io->aiocb.aio_buf = buf;
-  io->action = this;
-  io->thread = mutex->thread_holding;
-  ink_assert(ink_aio_write(io) >= 0);
-  hotset_idx++;
-  return 0;
-}
-
-int
-AIO_Device::do_fd(int event, Event * e)
-{
-  if (!time_start) {
-    time_start = ink_get_hrtime();
-    fprintf(stderr, "Starting the aio_testing \n");
-  }
-  if ((ink_get_hrtime() - time_start) > (run_time * HRTIME_SECOND)) {
-    time_end = ink_get_hrtime();
-    ink_atomic_increment(&n_accessors, -1);
-    if (n_accessors <= 0)
-      dump_summary();
-    return 0;
-  }
-
-  ink_off_t max_offset = ((ink_off_t) disk_size) * 1024 * 1024; // MB-GB
-  ink_off_t max_hotset_offset = ((ink_off_t) hotset_size) * 1024 * 1024;        // MB-GB
-  ink_off_t seq_read_point = ((ink_off_t) MIN_OFFSET);
-  ink_off_t seq_write_point = ((ink_off_t) MIN_OFFSET) + max_offset / 2 + write_after * 1024 * 1024;
-  seq_write_point += (id % n_disk_path) * (max_offset / (threads_per_disk * 4));
-  if (seq_write_point > max_offset)
-    seq_write_point = MIN_OFFSET;
-
-  if (io->aiocb.aio_lio_opcode == LIO_READ) {
-    ink_assert(!do_check_data(io->aiocb.aio_nbytes, io->aiocb.aio_offset));
-  }
-  memset((void *) buf, 0, max_size);
-  io->aiocb.aio_fildes = fd;
-  io->aiocb.aio_buf = buf;
-  io->action = this;
-  io->thread = mutex->thread_holding;
-
-  switch (select_mode(drand48())) {
-  case READ_MODE:
-    io->aiocb.aio_offset = seq_read_point;
-    io->aiocb.aio_nbytes = seq_read_size;
-    io->aiocb.aio_lio_opcode = LIO_READ;
-    ink_assert(ink_aio_read(io) >= 0);
-    seq_read_point += seq_read_size;
-    if (seq_read_point > max_offset)
-      seq_read_point = MIN_OFFSET;
-    seq_reads++;
-    break;
-  case WRITE_MODE:
-    io->aiocb.aio_offset = seq_write_point;
-    io->aiocb.aio_nbytes = seq_write_size;
-    io->aiocb.aio_lio_opcode = LIO_WRITE;
-    do_touch_data(seq_write_size, ((int) seq_write_point) % 1024);
-    ink_assert(ink_aio_write(io) >= 0);
-    seq_write_point += seq_write_size;
-    seq_write_point += write_skip;
-    if (seq_write_point > max_offset)
-      seq_write_point = MIN_OFFSET;
-
-    seq_writes++;
-    break;
-  case RANDOM_READ_MODE:{
-      // fprintf(stderr, "random read started \n");
-      double p, f;
-      p = drand48();
-      f = drand48();
-      ink_off_t o = 0;
-      if (f < hotset_frequency)
-        o = (ink_off_t) p *max_hotset_offset;
-      else
-        o = (ink_off_t) p *(max_offset - rand_read_size);
-      if (o < MIN_OFFSET)
-        o = MIN_OFFSET;
-      o = (o + (seq_read_size - 1)) & (~(seq_read_size - 1));
-      io->aiocb.aio_offset = o;
-      io->aiocb.aio_nbytes = rand_read_size;
-      io->aiocb.aio_lio_opcode = LIO_READ;
-      ink_assert(ink_aio_read(io) >= 0);
-      rand_reads++;
-      break;
-    }
-  }
-  return 0;
-}
-
-#define PARAM(_s) \
-        else if (strcmp(field_name, #_s) == 0) { \
-            fin >> _s; \
-            cout << "reading " #_s " = "  \
-                 << _s << endl; \
-				  }
-
-int
-read_config(const char *config_filename)
-{
-  ifstream fin(config_filename);
-  char field_name[256];
-  char field_value[256];
-
-  if (!fin.rdbuf()->is_open()) {
-    fin.open("sample.cfg");
-    if (!fin.rdbuf()->is_open()) {
-      cout << "cannot open config files " << config_filename << endl;
-      return (0);
-    }
-  }
-  while (!fin.eof()) {
-    field_name[0] = '\0';
-    fin >> field_name;
-    if (0) {
-    }
-    PARAM(hotset_size)
-      PARAM(hotset_frequency)
-      PARAM(touch_data)
-      PARAM(use_lseek)
-      PARAM(write_after)
-      PARAM(write_skip)
-      PARAM(disk_size)
-      PARAM(seq_read_percent)
-      PARAM(seq_write_percent)
-      PARAM(rand_read_percent)
-      PARAM(seq_read_size)
-      PARAM(seq_write_size)
-      PARAM(rand_read_size)
-      PARAM(run_time)
-      PARAM(chains)
-      PARAM(threads_per_disk)
-      PARAM(delete_disks)
-      else if (strcmp(field_name, "disk_path") == 0) {
-      assert(n_disk_path < MAX_DISK_THREADS);
-      fin >> field_value;
-      disk_path[n_disk_path] = xstrdup(field_value);
-      cout << "reading disk_path = " << disk_path[n_disk_path] << endl;
-      n_disk_path++;
-    }
-  }
-  assert(read_size > 0);
-  int t = seq_read_size + seq_write_size + rand_read_size;
-  real_seq_read_percent = seq_read_percent;
-  real_seq_write_percent = seq_write_percent;
-  real_rand_read_percent = rand_read_percent;
-  if (seq_read_size)
-    real_seq_read_percent *= t / seq_read_size;
-  if (seq_write_size)
-    real_seq_write_percent *= t / seq_write_size;
-  if (rand_read_size)
-    real_rand_read_percent *= t / rand_read_size;
-  float tt = real_seq_read_percent + real_seq_write_percent + real_rand_read_percent;
-  real_seq_read_percent = real_seq_read_percent / tt;
-  real_seq_write_percent = real_seq_write_percent / tt;
-  real_rand_read_percent = real_rand_read_percent / tt;
-  return (1);
-}
-
-
-
-
-int
-main(int argc, char *argv[])
-{
-  int i;
-  int num_net_threads = ink_number_of_processors();
-  init_diags("", NULL);
-  RecProcessInit(RECM_STAND_ALONE);
-  ink_event_system_init(EVENT_SYSTEM_MODULE_VERSION);
-  eventProcessor.start(num_net_threads);
-  RecProcessStart();
-  ink_aio_init(AIO_MODULE_VERSION);
-  srand48(time(NULL));
-
-  if (!read_config(argv[1]))
-    exit(1);
-
-  max_size = seq_read_size;
-  if (seq_write_size > max_size)
-    max_size = seq_write_size;
-  if (rand_read_size > max_size)
-    max_size = rand_read_size;
-
-
-  cache_config_threads_per_disk = threads_per_disk;
-  orig_n_accessors = n_disk_path * threads_per_disk;
-
-  for (i = 0; i < n_disk_path; i++) {
-    for (int j = 0; j < threads_per_disk; j++) {
-      dev[n_accessors] = new AIO_Device(new_ProxyMutex());
-      dev[n_accessors]->id = i * threads_per_disk + j;
-      dev[n_accessors]->path = disk_path[i];
-      dev[n_accessors]->seq_reads = 0;
-      dev[n_accessors]->seq_writes = 0;
-      dev[n_accessors]->rand_reads = 0;
-      dev[n_accessors]->fd = open(dev[n_accessors]->path, O_RDWR | O_CREAT);
-      fchmod(dev[n_accessors]->fd, S_IRWXU | S_IRWXG);
-      if (dev[n_accessors]->fd < 0) {
-        perror(disk_path[i]);
-        exit(1);
-      }
-      dev[n_accessors]->buf = (char *) valloc(max_size);
-      eventProcessor.schedule_imm(dev[n_accessors]);
-      n_accessors++;
-    }
-  }
-
-  this_thread()->execute();
-}

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3116860e/iocore/aio/test_AIO.sample
----------------------------------------------------------------------
diff --git a/iocore/aio/test_AIO.sample b/iocore/aio/test_AIO.sample
new file mode 100755
index 0000000..2713f07
--- /dev/null
+++ b/iocore/aio/test_AIO.sample
@@ -0,0 +1,2 @@
+#! /usr/bin/env sh
+exec ./test_AIO $srcdir/sample.cfg

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3116860e/iocore/aio/test_I_AIO.cc
----------------------------------------------------------------------
diff --git a/iocore/aio/test_I_AIO.cc b/iocore/aio/test_I_AIO.cc
deleted file mode 100644
index bd6f826..0000000
--- a/iocore/aio/test_I_AIO.cc
+++ /dev/null
@@ -1,25 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#include "I_AIO.h"
-#include "test_AIO.i"

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3116860e/iocore/aio/test_P_AIO.cc
----------------------------------------------------------------------
diff --git a/iocore/aio/test_P_AIO.cc b/iocore/aio/test_P_AIO.cc
deleted file mode 100644
index 2af02cd..0000000
--- a/iocore/aio/test_P_AIO.cc
+++ /dev/null
@@ -1,25 +0,0 @@
-/** @file
-
-  A brief file description
-
-  @section license License
-
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
- */
-
-#include "P_AIO.h"
-#include "test_AIO.i"

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3116860e/lib/ts/Diags.cc
----------------------------------------------------------------------
diff --git a/lib/ts/Diags.cc b/lib/ts/Diags.cc
index d7b9245..a410a26 100644
--- a/lib/ts/Diags.cc
+++ b/lib/ts/Diags.cc
@@ -99,8 +99,9 @@ SrcLoc::str(char *buf, int buflen)
 //
 //////////////////////////////////////////////////////////////////////////////
 
-Diags::Diags(char *bdt, char *bat, FILE * _diags_log_fp):
-diags_log_fp(_diags_log_fp), show_location(0)
+Diags::Diags(const char *bdt, const char *bat, FILE * _diags_log_fp)
+  : diags_log_fp(_diags_log_fp), show_location(0),
+    base_debug_tags(NULL), base_action_tags(NULL)
 {
   int i;
 
@@ -112,8 +113,6 @@ diags_log_fp(_diags_log_fp), show_location(0)
   // initialize the default, base debugging/action tags //
   ////////////////////////////////////////////////////////
 
-  base_debug_tags = NULL;
-  base_action_tags = NULL;
   if (bdt && *bdt) {
     base_debug_tags = ats_strdup(bdt);
   }
@@ -146,8 +145,8 @@ Diags::~Diags()
 {
   diags_log_fp = NULL;
 
-  ats_free(base_debug_tags);
-  ats_free(base_action_tags);
+  ats_free((void *)base_debug_tags);
+  ats_free((void *)base_action_tags);
 
   deactivate_all(DiagsTagType_Debug);
   deactivate_all(DiagsTagType_Action);
@@ -406,7 +405,7 @@ Diags::tag_activated(const char *tag, DiagsTagType mode)
 //////////////////////////////////////////////////////////////////////////////
 
 void
-Diags::activate_taglist(char *taglist, DiagsTagType mode)
+Diags::activate_taglist(const char *taglist, DiagsTagType mode)
 {
   if (taglist) {
     lock();

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3116860e/lib/ts/Diags.h
----------------------------------------------------------------------
diff --git a/lib/ts/Diags.h b/lib/ts/Diags.h
index 17243df..7adbe62 100644
--- a/lib/ts/Diags.h
+++ b/lib/ts/Diags.h
@@ -150,7 +150,7 @@ SrcLoc():valid(false), file(NULL), func(NULL), line(0) {
 class Diags
 {
 public:
-  Diags(char *base_debug_tags, char *base_action_tags, FILE * _diags_log_fp = NULL);
+  Diags(const char *base_debug_tags, const char *base_action_tags, FILE * _diags_log_fp = NULL);
    ~Diags();
 
   FILE *diags_log_fp;
@@ -227,12 +227,12 @@ public:
 
   void dump(FILE * fp = stdout);
 
-  void activate_taglist(char *taglist, DiagsTagType mode = DiagsTagType_Debug);
+  void activate_taglist(const char *taglist, DiagsTagType mode = DiagsTagType_Debug);
 
   void deactivate_all(DiagsTagType mode = DiagsTagType_Debug);
 
-  char *base_debug_tags;        // internal copy of default debug tags
-  char *base_action_tags;       // internal copy of default action tags
+  const char *base_debug_tags;        // internal copy of default debug tags
+  const char *base_action_tags;       // internal copy of default action tags
 
 private:
   ink_mutex tag_table_lock;     // prevents reconfig/read races

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3116860e/mgmt/ProcessManager.cc
----------------------------------------------------------------------
diff --git a/mgmt/ProcessManager.cc b/mgmt/ProcessManager.cc
index e5ed9dd..e68660a 100644
--- a/mgmt/ProcessManager.cc
+++ b/mgmt/ProcessManager.cc
@@ -310,8 +310,8 @@ ProcessManager::handleMgmtMsgFromLM(MgmtMessageHdr * mh)
     signalMgmtEntity(MGMT_EVENT_ROLL_LOG_FILES);
     break;
   case MGMT_EVENT_PLUGIN_CONFIG_UPDATE:
-    if (data_raw != NULL && data_raw[0] != '\0') {
-      global_config_cbs->invoke(data_raw);
+    if (data_raw != NULL && data_raw[0] != '\0' && this->cbtable) {
+      this->cbtable->invoke(data_raw);
     }
     break;
   case MGMT_EVENT_HTTP_CLUSTER_DELTA:

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3116860e/mgmt/ProcessManager.h
----------------------------------------------------------------------
diff --git a/mgmt/ProcessManager.h b/mgmt/ProcessManager.h
index 8073c53..419c41c 100644
--- a/mgmt/ProcessManager.h
+++ b/mgmt/ProcessManager.h
@@ -42,17 +42,18 @@
 
 #include "ink_apidefs.h"
 
+class ConfigUpdateCbTable;
+
 void *startProcessManager(void *arg);
 class ProcessManager:public BaseManager
 {
 
 public:
   ProcessManager(bool rlm, char *mpath);
-   ~ProcessManager()
+  ~ProcessManager()
   {
-      close_socket(local_manager_sockfd);
-    while (!queue_is_empty(mgmt_signal_queue))
-    {
+    close_socket(local_manager_sockfd);
+    while (!queue_is_empty(mgmt_signal_queue)) {
       char *sig = (char *) dequeue(mgmt_signal_queue);
       ats_free(sig);
     }
@@ -81,6 +82,10 @@ public:
   bool processEventQueue();
   bool processSignalQueue();
 
+  void registerPluginCallbacks(ConfigUpdateCbTable * _cbtable) {
+    cbtable = _cbtable;
+  }
+
   bool require_lm;
   time_t timeout;
   char pserver_path[1024];
@@ -93,11 +98,7 @@ public:
   int local_manager_sockfd;
 
 private:
-
-  /*
-   * You should not be concerned what is under the covers.
-   */
-
+  ConfigUpdateCbTable * cbtable;
 };                              /* End class ProcessManager */
 
 #ifndef _PROCESS_MANAGER

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3116860e/proxy/DiagsConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/DiagsConfig.cc b/proxy/DiagsConfig.cc
index 5fe1ef7..38116a3 100644
--- a/proxy/DiagsConfig.cc
+++ b/proxy/DiagsConfig.cc
@@ -27,13 +27,11 @@
 #ifdef LOCAL_MANAGER
 
 #include "../mgmt/Main.h"
-#define MGMT_PTR       lmgmt
 #define DIAGS_LOG_FILE "manager.log"
 
 #else
 #include "Main.h"
 #include "ProxyConfig.h"
-#define MGMT_PTR       pmgmt
 #define DIAGS_LOG_FILE "diags.log"
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3116860e/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index f87eb37..9271770 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -86,6 +86,7 @@ extern "C" int plock(int);
 #include "RemapProcessor.h"
 #include "XmlUtils.h"
 #include "I_Tasks.h"
+#include "InkAPIInternal.h"
 
 #include <ts/ink_cap.h>
 
@@ -1735,6 +1736,7 @@ main(int argc, char **argv)
 #else
     api_init();                 // we still need to initialize some of the data structure other module needs.
     // i.e. http_global_hooks
+    pmgmt->registerPluginCallbacks(global_config_cbs);
 #endif
 
     // "Task" processor, possibly with its own set of task threads

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3116860e/proxy/Makefile.am
----------------------------------------------------------------------
diff --git a/proxy/Makefile.am b/proxy/Makefile.am
index 5086929..ff2529d 100644
--- a/proxy/Makefile.am
+++ b/proxy/Makefile.am
@@ -170,13 +170,14 @@ if BUILD_LUA_SUPPORT
 traffic_server_LDFLAGS += @LUA_LUAJIT_LDFLAGS@
 endif
 
-traffic_logcat_SOURCES = logcat.cc
+traffic_logcat_SOURCES = \
+  logcat.cc \
+  signals.cc \
+  InkXml.cc \
+  DiagsConfig.cc \
+  UglyLogStubs.cc
 traffic_logcat_LDFLAGS = @EXTRA_CXX_LDFLAGS@ @LIBTOOL_LINK_FLAGS@
 traffic_logcat_LDADD = \
-  signals.o \
-  InkXml.o \
-  DiagsConfig.o \
-  UglyLogStubs.o \
   logging/liblogging.a \
   $(top_builddir)/mgmt/utils/libutils_p.a \
   $(top_builddir)/mgmt/libmgmt_p.a \
@@ -188,13 +189,14 @@ traffic_logcat_LDADD = \
   @LIBEXPAT@ @LIBDEMANGLE@ @LIBMLD@ @LIBEXC@ -lm @LIBPROFILER@ \
   @LIBEXECINFO@
 
-traffic_logstats_SOURCES = logstats.cc
+traffic_logstats_SOURCES = \
+  logstats.cc \
+  signals.cc \
+  InkXml.cc \
+  DiagsConfig.cc \
+  UglyLogStubs.cc
 traffic_logstats_LDFLAGS = @EXTRA_CXX_LDFLAGS@ @LIBTOOL_LINK_FLAGS@
 traffic_logstats_LDADD = \
-  signals.o \
-  InkXml.o \
-  DiagsConfig.o \
-  UglyLogStubs.o \
   logging/liblogging.a \
   $(top_builddir)/mgmt/utils/libutils_p.a \
   $(top_builddir)/mgmt/libmgmt_p.a \
@@ -206,36 +208,39 @@ traffic_logstats_LDADD = \
   @LIBEXPAT@ @LIBDEMANGLE@ @LIBMLD@ @LIBEXC@ -lm @LIBPROFILER@ \
   @LIBEXECINFO@
 
-traffic_sac_SOURCES = sac.cc
+
+traffic_sac_SOURCES = \
+  sac.cc \
+  ICP.cc \
+  ICPConfig.cc \
+  ICPProcessor.cc \
+  ICPStats.cc \
+  IPAllow.cc \
+  ParentSelection.cc \
+  ControlBase.cc \
+  ControlMatcher.cc \
+  CacheControl.cc \
+  StatSystem.cc \
+  ReverseProxy.cc \
+  signals.cc \
+  Error.cc \
+  EventName.cc \
+  DiagsConfig.cc \
+  StatPages.cc \
+  PluginVC.cc \
+  AbstractBuffer.cc \
+  Transform.cc \
+  Prefetch.cc \
+  Update.cc \
+  Plugin.cc \
+  PluginDB.cc \
+  InkAPI.cc \
+  FetchSM.cc \
+  InkIOCoreAPI.cc \
+  InkXml.cc
+
 traffic_sac_LDFLAGS = @EXTRA_CXX_LDFLAGS@ @LIBTOOL_LINK_FLAGS@
 traffic_sac_LDADD = \
-  ICP.o \
-  ICPConfig.o \
-  ICPProcessor.o \
-  ICPStats.o \
-  IPAllow.o \
-  ParentSelection.o \
-  ControlBase.o \
-  ControlMatcher.o \
-  CacheControl.o \
-  StatSystem.o \
-  ReverseProxy.o \
-  signals.o \
-  Error.o \
-  EventName.o \
-  DiagsConfig.o \
-  StatPages.o \
-  PluginVC.o \
-  AbstractBuffer.o \
-  Transform.o \
-  Prefetch.o \
-  Update.o \
-  Plugin.o \
-  PluginDB.o \
-  InkAPI.o \
-  FetchSM.o \
-  InkIOCoreAPI.o \
-  InkXml.o \
   http/libhttp.a \
   http/remap/libhttp_remap.a \
   congest/libCongestionControl.a \
@@ -262,7 +267,7 @@ traffic_sac_LDADD = \
   @LIBZ@ @LIBLZMA@ @LIBEXECINFO@
 
 if BUILD_TESTS
-  traffic_sac_LDADD += RegressionSM.o
+  traffic_sac_SOURCES += RegressionSM.cc
 endif
 
 libTrafficServerStandalone_a_SOURCES = \
@@ -275,7 +280,6 @@ libTrafficServerStandalone_a_SOURCES = \
   AbstractBuffer.cc \
   Initialize.cc
 
-
 test_xml_parser_SOURCES = test_xml_parser.cc InkXml.cc DiagsConfig.cc
 
 versiondir = $(pkgsysconfdir)