Created
November 13, 2014 07:23
-
-
Save Hyunho/8b8ebaa8af7a8c0bb9a9 to your computer and use it in GitHub Desktop.
MLOGC trace 로그에서시간과 gap을 출력할 수 있다.
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/python | |
import sys | |
import re | |
from datetime import datetime | |
import time | |
if hasattr(datetime, 'strptime'): | |
#python 2.6 | |
strptime = datetime.strptime | |
else: | |
#python 2.4 equivalent | |
strptime = lambda date_string, format: datetime(*(time.strptime(date_string, format)[0:6])) | |
if len(sys.argv) < 2: | |
print("file name is omitted.") | |
sys.exit(-1) | |
filename = sys.argv[1] | |
fd = open(filename) | |
try_count = 0 | |
is_start = False | |
for line in fd: | |
# if re.search("Last logseq", line) and is_start: | |
# print "try : %d" % try_count | |
# try_count = try_count + 1 | |
if re.search("OPEN_OUTPUT_LOGFILE", line): | |
words= re.split('[\[\]\(\)]',line) | |
if strptime(words[1], '%Y-%m-%d %H:%M:%S') < strptime("2014-11-13 10:31:00", '%Y-%m-%d %H:%M:%S'): | |
is_start = True | |
print "%s, %s" % (words[1], words[8]) | |
# if strptime(words[1], '%Y-%m-%d %H:%M:%S') > strptime("2014-11-13 10:31:00", '%Y-%m-%d %H:%M:%S'): | |
# if int(words[8]) > 10000: | |
#strptime(words[1], '%Y-%m-%d %H:%M:%S') | |
fd.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment