+/* This is called from the setup code -- glkunix_startup_code(), for the
+ Unix version. If called, the interpreter will keep profiling information,
+ and write it out at shutdown time. If this is not called, the interpreter
+ will skip all the profiling code. (Although it won't be quite as fast
+ as if the VM_PROFILING symbol were compiled out entirely.)
+
+ The arguments are a little tricky, because I developed this on Unix,
+ but I want it to remain accessible on all platforms. Pass a writable
+ stream object as the first argument; at game-shutdown time, the terp
+ will write the profiling data to this object and then close it.
+
+ However, if it's not convenient to open a stream in the startup code,
+ you can simply pass a filename as the second argument. This filename
+ will be opened according to the usual Glk data file rules, which means
+ it may wind up in a sandboxed data directory. The filename should not
+ contain slashes or other pathname separators.
+
+ If you pass NULL for both arguments, a file called "profile-raw" will
+ be written.
+*/
+void setup_profile(strid_t stream, char *filename)
+{
+ profiling_active = TRUE;
+
+ if (stream)
+ profiling_stream = stream;
+ else if (filename)
+ profiling_filename = filename;
+ else
+ profiling_filename = "profile-raw";
+}
+