diff options
author | andrea gesmundo <andrea.gesmundo@gmail.com> | 2011-07-08 15:33:47 +0200 |
---|---|---|
committer | andrea gesmundo <andrea.gesmundo@gmail.com> | 2011-07-08 15:33:47 +0200 |
commit | ced7471ef004235e4ebef5247c0bdb77252d0aef (patch) | |
tree | d515ef83f5aa6272dd383ebb09756cd60f8fe1d3 /decoder/decoder.cc | |
parent | 85b7e8ae194d98ca85da1692e2679db8defff91b (diff) |
add cp time measure (def macro)
Diffstat (limited to 'decoder/decoder.cc')
-rw-r--r-- | decoder/decoder.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/decoder/decoder.cc b/decoder/decoder.cc index 8a4a1485..76f31352 100644 --- a/decoder/decoder.cc +++ b/decoder/decoder.cc @@ -46,6 +46,13 @@ #include "cfg_options.h" #endif +#ifdef CP_TIME + clock_t CpTime::time_; + void CpTime::Add(clock_t x){time_+=x;} + void CpTime::Sub(clock_t x){time_-=x;} + double CpTime::Get(){return (double)(time_)/CLOCKS_PER_SEC;} +#endif + static const double kMINUS_EPSILON = -1e-6; // don't be too strict using namespace std; @@ -806,11 +813,17 @@ bool DecoderImpl::Decode(const string& input, DecoderObserver* o) { Timer t("Forest rescoring:"); rp.models->PrepareForInput(smeta); Hypergraph rescored_forest; +#ifdef CP_TIME + CpTime::Sub(clock()); +#endif ApplyModelSet(forest, smeta, *rp.models, *rp.inter_conf, &rescored_forest); +#ifdef CP_TIME + CpTime::Add(clock()); +#endif forest.swap(rescored_forest); forest.Reweight(cur_weights); if (!SILENT) forest_stats(forest," " + passtr +" forest",show_tree_structure,oracle.show_derivation); |