示例#1
0
#!/bin/env python
'''
Test of 5M objects in dict(dict) (50x100000)
Result: 200M
'''

import sys
from meminfo import getusedmem

print >> sys.stderr, "Start: ", getusedmem()
data = dict()
for i in xrange(50):
    model = "%08d" % i
    data[model] = dict()
    for j in xrange(100000):
        data[model][j] = j
print >> sys.stderr, "Start: ", getusedmem()
示例#2
0
            print >> sys.stderr, u'ERROR in line %d: Table:' % n, m.group(
                1), ", Fields (%d):" % len(fields), m.group(
                    2), "=>", fields, ", Values (%d):" % len(values), m.group(
                        3), "=>", values
            return (False, None)
    else:
        print >> sys.stderr, u'ERROR in line %d: It\'s not SQL string' % n
        return (False, None)


if (__name__ == '__main__'):
    if len(sys.argv) != 2:
        print "Usage: %s <gzipeddumpfile> > <outputjson>" % sys.argv[0]
        exit(0)
    data = list()
    print >> sys.stderr, "Start:", getusedmem()
    file = gzip.open(sys.argv[1], 'r')
    if not file:
        print >> sys.stderr, u'ERROR: can\'t open dump'
        exit()
    for q, s in enumerate(file):
        ok, result = splitsql(q, s)
        if ok:
            data.append(result)
        if q > 500000:
            break
    file.close()
    print >> sys.stderr, "End process file:", getusedmem()
    print json.dumps(data, indent=1)
    print >> sys.stderr, "The end:", getusedmem()
示例#3
0
				else:
					result[1][fields[i]] = v[1]
			return (True, result)
		else:
			print >> sys.stderr, u'ERROR in line %d: Table:' % n, m.group(1), ", Fields (%d):" % len(fields), m.group(2), "=>", fields, ", Values (%d):" % len(values), m.group(3), "=>", values
			return (False, None)
	else:
		print >> sys.stderr, u'ERROR in line %d: It\'s not SQL string' % n
		return (False, None)

if (__name__ == '__main__'):
	if len(sys.argv) != 2:
		print "Usage: %s <gzipeddumpfile> > <outputjson>" % sys.argv[0]
		exit(0)
	data = list()
	print >> sys.stderr, "Start:", getusedmem()
	file = gzip.open(sys.argv[1], 'r')
	if not file:
		print >> sys.stderr, u'ERROR: can\'t open dump'
		exit()
	for q, s in enumerate(file):
		ok, result = splitsql(q, s)
		if ok:
			data.append(result)
		if q > 500000:
			break
	file.close()
	print >> sys.stderr, "End process file:", getusedmem()
	print json.dumps(data, indent=1)
	print >> sys.stderr, "The end:", getusedmem()
示例#4
0
#!/bin/env python
'''
Test of 5M objects in dict(dict) (50x100000)
Result: 200M
'''

import sys
from meminfo import getusedmem

print >> sys.stderr, "Start: ", getusedmem()
data = dict()
for i in xrange(50):
	model = "%08d" % i
	data[model]=dict()
	for j in xrange(100000):
		data[model][j]=j
print >> sys.stderr, "Start: ", getusedmem()