#!/usr/bin/env python

import profile, os
import sys, types

#sys.path.append("/home/tom/lib/python2.0/site-packages")

if os.getcwd()[-4:] == "test":
   sys.path.append("..")
else:
   sys.path.append(".")

import mpd

music = r"""
\staff{ \time 4/4 r16 [c d e] [f d e c] [g'8 c] [b c] |
               [d16 g, a b] [c a b g] [d'8 g] [f g] |
               [e16 a g f] [e g f a] [g f e d] [c e d f] }
\staff{ \time 4/4 r2 r16 [c d e] [f d e c] |
                [g'8 g,] r4 r16 [g'16 a b] [c a b g] |
                [c8 b] [c d] [e g,] [a b] |
                }
"""
#music = r"""\staff{ c' d }"""
def vis():
        import pstats
        p = pstats.Stats("profile.txt")
        ##p.strip_dirs().sort_stats('time').print_stats(30)
        p.strip_dirs().sort_stats('cumulative').print_stats()


def pass1():
        for n in range(2):
                score = mpd.parser.parse_to_score_object(music)
                eng = score.get_engravers(20)
score = mpd.parser.parse_to_score_object(music)
def pass2():
    for x in range(5):
        eng = score.get_engravers(20)

import time
t1 = time.clock()
#profile.run("pass2()", "profile.txt")
pass1()
t2 = time.clock()
print t2-t1
#vis()

