#include <cstring>#include <cstdlib>#include <iostream>#include <sys/types.h>#include <sys/mman.h>#include "timer.h"#include "util.h"Go to the source code of this file.
Functions | |
| string | gettempfolder () |
| string | createtempName () |
| void | createtempfile (mfstream &fileStream, string &filePath, std::ios_base::openmode flags) |
| void | removefile (const std::string &filePath) |
| void * | MMap (int fd, int access, off_t offset, size_t len, off_t *gap) |
| int | Munmap (void *p, size_t len, int sync) |
| void | ResetUserTime () |
| void | PrintUserTime (const std::string &message) |
| double | GetUserTime () |
| int | parseWords (char *sentence, const char **words, int max) |
| int | parseline (istream &inp, int Order, ngram &ng, float &prob, float &bow) |
Variables | |
| Timer | g_timer |
| void createtempfile | ( | mfstream & | fileStream, | |
| string & | filePath, | |||
| std::ios_base::openmode | flags | |||
| ) |
Definition at line 76 of file util.cpp.
References createtempName(), and mfstream::open().
Referenced by lmtable::checkbounds(), and main().


| string createtempName | ( | ) |
Definition at line 58 of file util.cpp.
References gettempfolder().
Referenced by createtempfile().


| string gettempfolder | ( | ) |
Definition at line 39 of file util.cpp.
References str.
Referenced by createtempName().

| double GetUserTime | ( | ) |
Total wall time that the global timer has been in the "running" state since it was first "started".
Definition at line 235 of file util.cpp.
References Timer::get_elapsed_time().

| void* MMap | ( | int | fd, | |
| int | access, | |||
| off_t | offset, | |||
| size_t | len, | |||
| off_t * | gap | |||
| ) |
Definition at line 144 of file util.cpp.
Referenced by lmtable::expand_level_mmap(), lmtable::reset_mmap(), and lmtable::resize_level_mmap().

| int Munmap | ( | void * | p, | |
| size_t | len, | |||
| int | sync | |||
| ) |
Definition at line 194 of file util.cpp.
Referenced by lmtable::delete_level_mmap(), lmtable::reset_mmap(), lmtable::resize_level_mmap(), and lmtable::~lmtable().

| int parseline | ( | istream & | inp, | |
| int | Order, | |||
| ngram & | ng, | |||
| float & | prob, | |||
| float & | bow | |||
| ) |
Definition at line 272 of file util.cpp.
References ngram::dict, LMTMAXLEV, MAX_LINE, dictionary::OOV(), parseWords(), ngram::pushw(), and ngram::size.

| int parseWords | ( | char * | sentence, | |
| const char ** | words, | |||
| int | max | |||
| ) |
Definition at line 243 of file util.cpp.
Referenced by lmmacro::load(), lmInterpolation::load(), lmclass::load(), main(), and parseline().

| void PrintUserTime | ( | const std::string & | message | ) |
Print out an optional message followed by the current global timer timing.
Definition at line 230 of file util.cpp.
References Timer::check().

| void removefile | ( | const std::string & | filePath | ) |
Definition at line 87 of file util.cpp.
Referenced by lmtable::checkbounds(), lmtable::compact_single_level(), main(), lmtable::remove_single_level(), mdiadaptlm::saveARPA_per_word(), and lmtable::savebin_level_nommap().

| void ResetUserTime | ( | ) |
Start global timer.
Definition at line 225 of file util.cpp.
References Timer::start().

1.5.9