[Libreoffice-commits] online.git: loolwsd/ClientSession.cpp loolwsd/DocumentBroker.cpp loolwsd/LOOLWSD.hpp loolwsd/PrisonerSession.cpp loolwsd/TraceFile.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Aug 8 03:52:18 UTC 2016
loolwsd/ClientSession.cpp | 2 +-
loolwsd/DocumentBroker.cpp | 2 +-
loolwsd/LOOLWSD.hpp | 8 ++++----
loolwsd/PrisonerSession.cpp | 2 +-
loolwsd/TraceFile.hpp | 23 ++++++++++++-----------
5 files changed, 19 insertions(+), 18 deletions(-)
New commits:
commit c304cbc95b8cfab213f4695d76dca41f274be18b
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Wed Aug 3 08:15:04 2016 -0400
loolstress: trace session ID and child pid
Change-Id: Iac6b3dadedfcdec91db21a5e90eb3827705281d4
Reviewed-on: https://gerrit.libreoffice.org/27966
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/ClientSession.cpp b/loolwsd/ClientSession.cpp
index 57da9a6..d2debdf 100644
--- a/loolwsd/ClientSession.cpp
+++ b/loolwsd/ClientSession.cpp
@@ -64,7 +64,7 @@ bool ClientSession::_handleInput(const char *buffer, int length)
StringTokenizer tokens(firstLine, " ", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
Log::trace(getName() + ": handling [" + firstLine + "].");
- LOOLWSD::dumpIncomingTrace(firstLine);
+ LOOLWSD::dumpIncomingTrace(_docBroker->getJailId(), getId(), firstLine);
if (LOOLProtocol::tokenIndicatesUserInteraction(tokens[0]))
{
diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp
index f998ab4..a0d59ca 100644
--- a/loolwsd/DocumentBroker.cpp
+++ b/loolwsd/DocumentBroker.cpp
@@ -454,7 +454,7 @@ bool DocumentBroker::handleInput(const std::vector<char>& payload)
Log::trace("DocumentBroker got child message: [" + LOOLProtocol::getAbbreviatedMessage(payload) + "].");
const auto command = LOOLProtocol::getFirstToken(payload);
- LOOLWSD::dumpOutgoingTrace(command);
+ LOOLWSD::dumpOutgoingTrace(getJailId(), "0", command);
if (command == "tile:")
{
diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp
index 588c37d..1544fd1 100644
--- a/loolwsd/LOOLWSD.hpp
+++ b/loolwsd/LOOLWSD.hpp
@@ -71,20 +71,20 @@ public:
}
static
- void dumpIncomingTrace(const std::string& data)
+ void dumpIncomingTrace(const std::string& pId, const std::string& sessionId, const std::string& data)
{
if (TraceDumper)
{
- TraceDumper->writeIncoming(data);
+ TraceDumper->writeIncoming(pId, sessionId, data);
}
}
static
- void dumpOutgoingTrace(const std::string& data)
+ void dumpOutgoingTrace(const std::string& pId, const std::string& sessionId, const std::string& data)
{
if (TraceDumper)
{
- TraceDumper->writeOutgoing(data);
+ TraceDumper->writeOutgoing(pId, sessionId, data);
}
}
diff --git a/loolwsd/PrisonerSession.cpp b/loolwsd/PrisonerSession.cpp
index 2114f5c..95a5fbd 100644
--- a/loolwsd/PrisonerSession.cpp
+++ b/loolwsd/PrisonerSession.cpp
@@ -54,7 +54,7 @@ bool PrisonerSession::_handleInput(const char *buffer, int length)
StringTokenizer tokens(firstLine, " ", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
Log::trace(getName() + ": handling [" + firstLine + "].");
- LOOLWSD::dumpOutgoingTrace(firstLine);
+ LOOLWSD::dumpOutgoingTrace(_docBroker->getJailId(), getId(), firstLine);
if (LOOLProtocol::tokenIndicatesUserInteraction(tokens[0]))
{
diff --git a/loolwsd/TraceFile.hpp b/loolwsd/TraceFile.hpp
index 6e8a6a9..cd429a6 100644
--- a/loolwsd/TraceFile.hpp
+++ b/loolwsd/TraceFile.hpp
@@ -31,8 +31,9 @@ public:
}
Direction Dir;
- unsigned Pid;
unsigned TimestampNs;
+ unsigned Pid;
+ unsigned SessionId;
std::string Payload;
};
@@ -52,31 +53,31 @@ public:
void writeEvent(const std::string& pId, const std::string& sessionId, const std::string& data)
{
- (void)pId;
- (void)sessionId;
- write(data, static_cast<char>(TraceFileRecord::Direction::Event));
+ write(pId, sessionId, data, static_cast<char>(TraceFileRecord::Direction::Event));
}
- void writeIncoming(const std::string& data)
+ void writeIncoming(const std::string& pId, const std::string& sessionId, const std::string& data)
{
- write(data, static_cast<char>(TraceFileRecord::Direction::Incoming));
+ write(pId, sessionId, data, static_cast<char>(TraceFileRecord::Direction::Incoming));
}
- void writeOutgoing(const std::string& data)
+ void writeOutgoing(const std::string& pId, const std::string& sessionId, const std::string& data)
{
- write(data, static_cast<char>(TraceFileRecord::Direction::Outgoing));
+ write(pId, sessionId, data, static_cast<char>(TraceFileRecord::Direction::Outgoing));
}
private:
- void write(const std::string& data, const char delim)
+ void write(const std::string& pId, const std::string& sessionId, const std::string& data, const char delim)
{
std::unique_lock<std::mutex> lock(_mutex);
const Poco::Int64 usec = Poco::Timestamp().epochMicroseconds() - _epochStart;
_stream.write(&delim, 1);
- _stream << getpid();
- _stream.write(&delim, 1);
_stream << usec;
_stream.write(&delim, 1);
+ _stream << pId;
+ _stream.write(&delim, 1);
+ _stream << sessionId;
+ _stream.write(&delim, 1);
_stream.write(data.c_str(), data.size());
_stream.write("\n", 1);
}
More information about the Libreoffice-commits
mailing list