0ad/source/lib/res/file/vfs_optimizer.h
janwas 06412a7751 allocators: bugfix (wasn't setting freelist to 0)
archive: afile_read bugfix (wasn't returning byte count)
byte_order: add to_leXX, implement read_leXX in terms of that, add
write_leXX (and also big-endian versions)
compression: support 0 length buffers + minor fixes
file: no longer support passing fn_len (that didn't work anyway due to
DynHashTbl find(const char*) interface); add FILE_DONT_SET_FN
optimization that prevents cluttering name cache.
file_cache: add logic to verify load/free/load/free sequence; add
FILE_LONG_LIVED flag to specify exceptions (e.g. XMB files that don't
free their buffer immediately)
vfs_mount/vfs_tree: bugfix (was mixing up portable and VFS paths)
vfs_optimizer: small fixes; creating Zip files now works
vfs_tree: add PathName that stores pointer to path and name component
for efficiency + convenience
zip: bugfixes (wasn't endian safe; incorrect handling of cmethod; forgot
to initialize ZipArchive members)

config: add -buildarchive flag
Xeromyces.cpp, FileUnpacker.cpp: add FILE_LONG_LIVED
mapreader: bump time estimate for ReadXML

This was SVN commit r3446.
2006-01-31 03:47:52 +00:00

46 lines
1.3 KiB
C

#ifndef VFS_OPTIMIZER_H__
#define VFS_OPTIMIZER_H__
extern void trace_enable(bool want_enabled);
extern void trace_shutdown();
extern void trace_notify_load(const char* P_fn, uint flags);
extern void trace_notify_free(const char* P_fn);
// TraceEntry operation type.
// note: rather than only a list of accessed files, we also need to
// know the application's behavior WRT caching (e.g. when it releases
// cached buffers). this is necessary so that our simulation can
// yield the same results.
enum TraceOp
{
TO_LOAD,
TO_FREE
};
// stores one event that is relevant for file IO / caching.
//
// size-optimized a bit since these are all kept in memory
// (to prevent trace file writes from affecting other IOs)
struct TraceEntry
{
double timestamp; // returned by get_time before operation starts
const char* atom_fn; // path+name of affected file
uint op : 8; // operation - see TraceOp
uint flags : 24; // misc, e.g. file_io flags.
};
struct Trace
{
const TraceEntry* ents;
size_t num_ents;
};
extern void trace_get(Trace* t);
extern LibError trace_write_to_file(const char* trace_filename);
extern LibError trace_read_from_file(const char* trace_filename, Trace* t);
extern LibError build_optimized_archive(const char* trace_filename, const char* zip_filename);
#endif // #ifndef VFS_OPTIMIZER_H__