Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormfederico <mfederico@1f5c12ca-751b-0410-a591-d2e778427230>2006-08-14 06:49:35 +0400
committermfederico <mfederico@1f5c12ca-751b-0410-a591-d2e778427230>2006-08-14 06:49:35 +0400
commitd0a573bc517d11deebea1bafbb91bacc5dfa8ab5 (patch)
tree373d199a3731e58a3ba34eaec8963a1b1d2e5334 /irstlm/src/lmtable.h
parent7cc3d890b197e51fd1c44f7443349158e5854133 (diff)
added tracing of cache usage
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@705 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'irstlm/src/lmtable.h')
-rw-r--r--irstlm/src/lmtable.h26
1 files changed, 21 insertions, 5 deletions
diff --git a/irstlm/src/lmtable.h b/irstlm/src/lmtable.h
index 32a291d45..e2b6bb4e2 100644
--- a/irstlm/src/lmtable.h
+++ b/irstlm/src/lmtable.h
@@ -26,6 +26,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "dictionary.h"
#include "n_gram.h"
+#undef TRACE_CACHE
+
#define LMTMAXLEV 11
#ifndef LMTCODESIZE
@@ -140,15 +142,20 @@ class lmtable{
ngramcache* probcache;
ngramcache* statecache;
int max_cache_lev;
-
+
public:
+#ifdef TRACE_CACHE
+ std::fstream* cacheout;
+ int sentence_id;
+#endif
+
dictionary *dict; // dictionary
lmtable();
~lmtable(){
- for (int i=2;i<=max_cache_lev;i++)
+ for (int i=2;i<=LMTMAXLEV;i++)
if (lmtcache[i]){
std::cerr << i <<"-gram cache: "; lmtcache[i]->stat();
delete lmtcache[i];
@@ -157,6 +164,11 @@ public:
if (probcache){
std::cerr << "Prob Cache: "; probcache->stat();
delete probcache;
+#if TRACE_CACHE
+ cacheout->close();
+ delete cacheout;
+#endif
+
}
if (statecache){
std::cerr << "State Cache: "; statecache->stat();
@@ -176,19 +188,23 @@ public:
void init_probcache(){
assert(probcache==NULL);
- probcache=new ngramcache(maxlev,sizeof(double),1000000);
+ probcache=new ngramcache(maxlev,sizeof(double),200000);
+#ifdef TRACE_CACHE
+ cacheout=new std::fstream("/tmp/tracecache",std::ios::out);
+ sentence_id=0;
+#endif
}
void init_statecache(){
assert(statecache==NULL);
- statecache=new ngramcache(maxlev-1,sizeof(char *),200000);
+ statecache=new ngramcache(maxlev-1,sizeof(char *),100000);
}
void init_lmtcaches(int uptolev){
max_cache_lev=uptolev;
for (int i=2;i<=max_cache_lev;i++){
assert(lmtcache[i]==NULL);
- lmtcache[i]=new ngramcache(i,sizeof(char *),2000000);
+ lmtcache[i]=new ngramcache(i,sizeof(char *),200000);
}
}