-b eps -> -dbackend=eps
[lilypond.git] / lily / profile.cc
blob0390a64a627d1b8180f71643ccf8bed85c374745
1 /*
2 profile.cc -- implement profiling utilities.
4 source file of the GNU LilyPond music typesetter
6 (c) 2005--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
9 #include "profile.hh"
11 void note_property_access (SCM *table, SCM sym);
13 SCM context_property_lookup_table;
14 SCM grob_property_lookup_table;
15 SCM prob_property_lookup_table;
17 LY_DEFINE (ly_property_lookup_stats, "ly:property-lookup-stats",
18 1, 0, 0, (SCM sym),
19 "Return hash table with a property access corresponding to @var{sym}. "
20 "Choices are prob, grob and context.")
22 if (sym == ly_symbol2scm ("context"))
23 return context_property_lookup_table ? context_property_lookup_table
24 : scm_c_make_hash_table (1);
25 if (sym == ly_symbol2scm ("prob"))
26 return prob_property_lookup_table ? prob_property_lookup_table
27 : scm_c_make_hash_table (1);
28 if (sym == ly_symbol2scm ("grob"))
29 return grob_property_lookup_table ? grob_property_lookup_table
30 : scm_c_make_hash_table (1);
31 return scm_c_make_hash_table (1);
35 void
36 note_property_access (SCM *table, SCM sym)
39 Statistics: which properties are looked up?
41 if (!*table)
42 *table = scm_permanent_object (scm_c_make_hash_table (259));
44 SCM hashhandle = scm_hashq_get_handle (*table, sym);
45 if (hashhandle == SCM_BOOL_F)
47 scm_hashq_set_x (*table, sym, scm_from_int (0));
48 hashhandle = scm_hashq_get_handle (*table, sym);
51 int count = scm_to_int (scm_cdr (hashhandle)) + 1;
52 scm_set_cdr_x (hashhandle, scm_from_int (count));