Date: Thu, 9 May 2013 16:06:08 +0800 (CST) From: Hung-Yi Chen <gaod@hychen.org> To: FreeBSD-gnats-submit@freebsd.org Subject: ports/178441: [NEW PORT] databases/memkeys: A tool to show memcache key usage in realtime Message-ID: <201305090806.r49868kM031305@cse.tw> Resent-Message-ID: <201305090810.r498A29J082888@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 178441 >Category: ports >Synopsis: [NEW PORT] databases/memkeys: A tool to show memcache key usage in realtime >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu May 09 08:10:01 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Hung-Yi Chen >Release: FreeBSD 9.1-RELEASE amd64 >Organization: >Environment: System: FreeBSD cse.tw 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243825: Tue Dec 4 09:23:10 UTC 2012 root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 >Description: Show your memcache key usage in realtime. This was originally inspired by mctop from etsy. WWW: https://github.com/tumblr/memkeys >How-To-Repeat: >Fix: --- memkeys.diff begins here --- Index: databases/Makefile =================================================================== --- databases/Makefile (revision 317561) +++ databases/Makefile (working copy) @@ -198,6 +198,7 @@ SUBDIR += memcached12 SUBDIR += memcachedb SUBDIR += memcacheq + SUBDIR += memkeys SUBDIR += mergeant SUBDIR += metakit SUBDIR += mird Index: databases/memkeys/Makefile =================================================================== --- databases/memkeys/Makefile (revision 0) +++ databases/memkeys/Makefile (working copy) @@ -0,0 +1,34 @@ +# Created by: Hung-Yi Chen <gaod@hychen.org> +# $FreeBSD$ + +PORTNAME= memkeys +PORTVERSION= 20130503 +CATEGORIES= devel +MASTER_SITES= GH GHC +DISTNAME= ${GH_ACCOUNT}-${GH_PROJECT}-${GH_COMMIT} + +MAINTAINER= gaod@hychen.org +COMMENT= A tool to show your memcache key usage in realtime + +LICENSE= AL2 + +PLIST_FILES= bin/memkeys + +USE_GITHUB= yes +GH_ACCOUNT= tumblr +GH_PROJECT= memkeys +GH_COMMIT= 75fc345 +GH_TAGNAME= ${GH_COMMIT} +USE_GMAKE= yes +USE_GCC= 4.6+ +GNU_CONFIGURE= yes +USE_AUTOTOOLS= libtool:env aclocal:env autoheader:env automake:env autoconf:env + +CONFIGURE_ARGS+= --prefix=${PREFIX}/${PORTNAME} + +WRKSRC= ${WRKDIR}/${DISTNAME} + +pre-configure: + cd ${WRKSRC}; ${SH} autogen.sh + +.include <bsd.port.mk> Index: databases/memkeys/distinfo =================================================================== --- databases/memkeys/distinfo (revision 0) +++ databases/memkeys/distinfo (working copy) @@ -0,0 +1,2 @@ +SHA256 (tumblr-memkeys-75fc345.tar.gz) = 80017b28b2f0c6779de62e7f46dca31dcdcc8ef3b0d64597bb7db3184af790cc +SIZE (tumblr-memkeys-75fc345.tar.gz) = 34083 Index: databases/memkeys/files/patch-configure.ac =================================================================== --- databases/memkeys/files/patch-configure.ac (revision 0) +++ databases/memkeys/files/patch-configure.ac (working copy) @@ -0,0 +1,11 @@ +--- /net/account/admin/gaod/memkeys/configure.ac 2013-05-07 05:17:51.035222000 +0800 ++++ configure.ac 2013-05-07 03:45:51.000000000 +0800 +@@ -14,7 +14,7 @@ + + # Checks for programs + CXXFLAGS="$CXXFLAGS -std=c++0x" # Will fail if not g++44 or later +-AC_PROG_CXX([g++44 g++ gcc cxx cc++ c++]) ++AC_PROG_CXX([g++46 g++47 g++48 g++49 g++ gcc cxx cc++ c++]) + AC_PROG_CXXCPP + CXXCPP="$CXXCPP -std=c++0x" # This must come after AC_PROG_CXXCPP + AC_PROG_LIBTOOL Index: databases/memkeys/files/patch-src_config.cpp =================================================================== --- databases/memkeys/files/patch-src_config.cpp (revision 0) +++ databases/memkeys/files/patch-src_config.cpp (working copy) @@ -0,0 +1,21 @@ +--- /net/account/admin/gaod/memkeys/src/config.cpp 2013-05-07 05:17:51.066194000 +0800 ++++ src/config.cpp 2013-05-07 04:23:42.000000000 +0800 +@@ -1,6 +1,7 @@ + #include "common.h" + #include <fstream> + #include <iostream> ++#include <sstream> + + namespace mckeys { + +@@ -81,7 +82,9 @@ + } + string Config::getPortAsString() const + { +- return to_string((llui_t)getPort()); ++ stringstream strstream; ++ strstream << (llui_t)getPort(); ++ return strstream.str(); + } + + /** Index: databases/memkeys/files/patch-src_logging_record.cpp =================================================================== --- databases/memkeys/files/patch-src_logging_record.cpp (revision 0) +++ databases/memkeys/files/patch-src_logging_record.cpp (working copy) @@ -0,0 +1,18 @@ +--- /net/account/admin/gaod/memkeys/src/logging/record.cpp 2013-05-07 05:17:51.075182000 +0800 ++++ src/logging/record.cpp 2013-05-07 03:56:52.000000000 +0800 +@@ -1,5 +1,6 @@ + #include <string> + #include <ctime> ++#include <cstdio> + + extern "C" { + #include <sys/time.h> +@@ -142,7 +143,7 @@ + strftime(buffer, 80, "%Y%m%d-%H:%M:%S", timeinfo); + + char result[100] = {0}; +- std::snprintf(result, 100, "%s.%03ld", buffer, (long)tv.tv_usec / 1000); ++ snprintf(result, 100, "%s.%03ld", buffer, (long)tv.tv_usec / 1000); + return result; + } + Index: databases/memkeys/files/patch-src_memkeys.cpp =================================================================== --- databases/memkeys/files/patch-src_memkeys.cpp (revision 0) +++ databases/memkeys/files/patch-src_memkeys.cpp (working copy) @@ -0,0 +1,21 @@ +--- /net/account/admin/gaod/memkeys/src/memkeys.cpp 2013-05-07 05:17:51.078181000 +0800 ++++ src/memkeys.cpp 2013-05-07 05:12:55.000000000 +0800 +@@ -1,6 +1,7 @@ + #include <cstring> + #include <string> + #include <stdexcept> ++#include <sstream> + + #include "cli.h" + #include "memkeys.h" +@@ -75,7 +76,9 @@ + signal(SIGINT, signal_cb); + state.setState(state_STARTING); + session->open(); +- logger->debug("My address: " + to_string((llsi_t)session->getIpAddress())); ++ stringstream strstream; ++ strstream << (llsi_t)session->getIpAddress(); ++ logger->debug("My address: " + strstream.str()); + session->setFilter(string("tcp port ") + config->getPortAsString()); + try { + state.setState(state_RUNNING); Index: databases/memkeys/files/patch-src_net_capture_engine.cpp =================================================================== --- databases/memkeys/files/patch-src_net_capture_engine.cpp (revision 0) +++ databases/memkeys/files/patch-src_net_capture_engine.cpp (working copy) @@ -0,0 +1,27 @@ +--- /net/account/admin/gaod/memkeys/src/net/capture_engine.cpp 2013-05-07 05:17:51.081178000 +0800 ++++ src/net/capture_engine.cpp 2013-05-07 05:10:50.000000000 +0800 +@@ -3,6 +3,7 @@ + #include "report/report.h" + #include "report/curses.h" + ++#include <sstream> + #include <vector> + + namespace mckeys { +@@ -130,10 +131,14 @@ + string out = getStatsString(); + uint64_t now = UtilTime::currentTimeMillis(); + llui_t tdiff = now - packet.timestamp(); ++ stringstream strstream; ++ strstream << resCount; + out.append(", memcache replies = "); +- out.append(to_string(resCount)); ++ out.append(strstream.str()); ++ strstream.clear(); + out.append(", time diff = "); +- out.append(to_string(tdiff)); ++ strstream << tdiff; ++ out.append(strstream.str()); + logger->debug(out); + } + } else { Index: databases/memkeys/files/patch-src_net_net.h =================================================================== --- databases/memkeys/files/patch-src_net_net.h (revision 0) +++ databases/memkeys/files/patch-src_net_net.h (working copy) @@ -0,0 +1,14 @@ +--- /net/account/admin/gaod/memkeys/src/net/net.h 2013-05-07 05:17:51.088168000 +0800 ++++ src/net/net.h 2013-05-07 05:04:18.000000000 +0800 +@@ -1,6 +1,11 @@ + #ifndef _NET_NET_H + #define _NET_NET_H + ++#include <sys/types.h> ++#include <sys/socket.h> ++#include <netinet/in.h> ++#include <net/if_arp.h> ++ + extern "C" { + #include <pcap.h> + } Index: databases/memkeys/pkg-descr =================================================================== --- databases/memkeys/pkg-descr (revision 0) +++ databases/memkeys/pkg-descr (working copy) @@ -0,0 +1,3 @@ +A top like tool for inspecting memcache key values in realtime. + +WWW: https://github.com/tumblr/memkeys --- memkeys.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305090806.r49868kM031305>