mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-20 09:15:01 +01:00
feat(physicslog): the logs written every two seconds by a thread of their own, no file kept open; the black box's tapes as it goes
"physicslog yes" kept the .dat of every vehicle with a driver open for the whole run and flushed it twenty times a second from the simulation's thread: some 580 open files on Tomaszewo. The lines are kept now and a thread of their own writes them every two seconds, each file opened only for the moment it is written to. The files, their lines and their text mode stay as they were. - The black box, with the physics logs off, writes the tapes of the user's vehicles through the same writer as it goes, not at the end. A log begins when the user is first in the vehicle and goes on while the user looks around outside, until another vehicle is taken; back in it, the log goes on after the gap. The vehicle's own driver keeps the log only if it is the primary one, as a passive one's clock stands still; otherwise the driver of its train does. - What is kept is written when the simulator closes, after the black box, at the end of a test run, and when the test watchdog ends a run. A crash loses the last two seconds. - On Tomaszewo with the black box alone, the one tape grows every two seconds. With "physicslog yes", the 581 logs grow and the simulator holds as many handles as without them; writing them takes the thread about 1.9 s, which the closing waits for once.
This commit is contained in:
11
EU07.cpp
11
EU07.cpp
@@ -22,6 +22,7 @@ Stele, firleju, szociu, hunter, ZiomalCl, OLI_EU and others
|
||||
#include "simulation/simulationtest.h"
|
||||
#include "utilities/Globals.h"
|
||||
#include "utilities/Logs.h"
|
||||
#include "utilities/physicslog.h"
|
||||
#include <cstdlib>
|
||||
#include <exception>
|
||||
#include <string_view>
|
||||
@@ -112,6 +113,8 @@ void finish_log()
|
||||
[[noreturn]] void end_test_run(std::string_view const Reason)
|
||||
{
|
||||
simulation::test().conclude(simulation::test_result::error, Reason);
|
||||
// the last two seconds of the physics logs, which the runner of the tests reads
|
||||
PhysicsLogs.stop();
|
||||
finish_log();
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
@@ -141,10 +144,10 @@ void finish_log()
|
||||
end_test_run("the simulator stopped before the test ended");
|
||||
}
|
||||
|
||||
// every vehicle with a driver keeps its physics log open for the whole run, and on a scenery with some five hundred
|
||||
// of them the logs took all the files the C library of Windows lets a process have open by default (512): the
|
||||
// files opened after them, the shaders of the map among them, couldn't be read. so the limit is raised to the most
|
||||
// either system allows
|
||||
// the physics logs used to keep a file open for every vehicle with a driver, and on a scenery with some five hundred
|
||||
// of them they took all the files the C library of Windows lets a process have open by default (512): the files
|
||||
// opened after them, the shaders of the map among them, couldn't be read. they keep none open now (physicslog.h),
|
||||
// but the limit is raised to the most either system allows still, for whatever else opens many files at once
|
||||
void raise_open_files_limit()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
||||
Reference in New Issue
Block a user