This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Public domain""" | |
import mmap | |
import os | |
PAGESIZE = mmap.PAGESIZE | |
def fileno_to_filename(fd): | |
"""Attempt to resolve fd to a filename or return None""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import mmstats | |
import libgettid | |
class MyStats(mmstats.BaseMmStats): | |
pid = mmstats.StaticUIntField(label="sys.pid", value=os.getpid) | |
tid = mmstats.StaticInt64Field(label="sys.tid", value=libgettid.gettid) | |
uid = mmstats.StaticUInt64Field(label="sys.uid", value=os.getuid) | |
gid = mmstats.StaticUInt64Field(label="sys.gid", value=os.getgid) | |
errors = mmstats.UIntStat(label="com.urbanairship.app.errors") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python slurpstats.py . | sort -r | |
==> /tmp/mmstats-test-mystats | |
sys.uid 1000 | |
sys.tid 6273 | |
sys.pid 6273 | |
sys.gid 1000 | |
com.urbanairship.app.warnings 0 | |
com.urbanairship.app.queries 0 | |
com.urbanairship.app.errors 1 | |
com.urbanairship.app.degraded True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import namedtuple | |
def read_shifty_csv(f): | |
cols = None | |
for line in f: | |
line = line.strip() | |
if line.startswith('#'): | |
cols = namedtuple('cols', line[1:].split(',')) | |
else: | |
yield cols(*line.split(',')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
CHUNK = 100 | |
if len(sys.argv) > 1: | |
CHUNK = int(sys.argv[1]) | |
vals = [] | |
i = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Host * | |
Protocol 2 | |
GSSAPIAuthentication no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
01:02 -!- jamwt [[email protected]] has quit [Quit: Computer has gone to sleep.] | |
09:11 < schmichael> you guys use 0mq? | |
09:12 < schmichael> i toyed with it for a bit, but just didn't feel comfortable with some of the high water mark buffering behavior | |
09:12 < schmichael> but i may not have been using the right socket types or just using 0mq for an inappropriate use case | |
09:14 < schmichael> ooh http-parser, nice | |
09:16 < schmichael> doh, no jamwt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
import sys | |
import mmstats | |
import mmstats.reader | |
class FastStats(mmstats.BaseMmStats): | |
a = mmstats.UInt64Field() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: compile palm | |
PALMC = bin/palmc | |
PIP = bin/pip | |
compile: | |
mvn clean compile | |
$(PIP): | |
# This is one way to install pip :| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
schmichael@git:master:~/src/mmstats$ python setup.py bdist_rpm --help | |
Common commands: (see '--help-commands' for more) | |
setup.py build will build the package underneath 'build/' | |
setup.py install will install the package | |
Global options: | |
--verbose (-v) run verbosely (default) | |
--quiet (-q) run quietly (turns verbosity off) | |
--dry-run (-n) don't actually do anything |
OlderNewer