aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/SocketProfilingConnection.cpp
diff options
context:
space:
mode:
authorMatteo Martincigh <matteo.martincigh@arm.com>2019-10-02 12:50:57 +0100
committerMatteo Martincigh <matteo.martincigh@arm.com>2019-10-07 10:34:54 +0100
commita84edee4702c112a6e004b1987acc11144e2d6dd (patch)
tree738ce957b2fa26423df188b0d370664d15c86665 /src/profiling/SocketProfilingConnection.cpp
parentd66d68b13fb309e8d4eac9435a58b89dd6a55158 (diff)
downloadarmnn-a84edee4702c112a6e004b1987acc11144e2d6dd.tar.gz
IVGCVSW-3937 Initial ServiceProfiling refactoring
* Made the ServiceProfiling class a singleton * Registered basic category and counters * Code refactoring * Updated unit tests accordingly Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com> Change-Id: I648a6202eead2a3016aac14d905511bd945a90cb
Diffstat (limited to 'src/profiling/SocketProfilingConnection.cpp')
-rw-r--r--src/profiling/SocketProfilingConnection.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/profiling/SocketProfilingConnection.cpp b/src/profiling/SocketProfilingConnection.cpp
index 45b7f9dcfe..6955f70a48 100644
--- a/src/profiling/SocketProfilingConnection.cpp
+++ b/src/profiling/SocketProfilingConnection.cpp
@@ -23,7 +23,7 @@ SocketProfilingConnection::SocketProfilingConnection()
m_Socket[0].fd = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
if (m_Socket[0].fd == -1)
{
- throw armnn::RuntimeException(std::string("Socket construction failed: ") + strerror(errno));
+ throw RuntimeException(std::string("Socket construction failed: ") + strerror(errno));
}
// Connect to the named unix domain socket.
@@ -35,7 +35,7 @@ SocketProfilingConnection::SocketProfilingConnection()
if (0 != connect(m_Socket[0].fd, reinterpret_cast<const sockaddr*>(&server), sizeof(sockaddr_un)))
{
close(m_Socket[0].fd);
- throw armnn::RuntimeException(std::string("Cannot connect to stream socket: ") + strerror(errno));
+ throw RuntimeException(std::string("Cannot connect to stream socket: ") + strerror(errno));
}
// Our socket will only be interested in polling reads.
@@ -46,7 +46,7 @@ SocketProfilingConnection::SocketProfilingConnection()
if (0 != fcntl(m_Socket[0].fd, F_SETFL, currentFlags | O_NONBLOCK))
{
close(m_Socket[0].fd);
- throw armnn::RuntimeException(std::string("Failed to set socket as non blocking: ") + strerror(errno));
+ throw RuntimeException(std::string("Failed to set socket as non blocking: ") + strerror(errno));
}
}
@@ -59,7 +59,7 @@ void SocketProfilingConnection::Close()
{
if (close(m_Socket[0].fd) != 0)
{
- throw armnn::RuntimeException(std::string("Cannot close stream socket: ") + strerror(errno));
+ throw RuntimeException(std::string("Cannot close stream socket: ") + strerror(errno));
}
memset(m_Socket, 0, sizeof(m_Socket));
@@ -83,17 +83,17 @@ Packet SocketProfilingConnection::ReadPacket(uint32_t timeout)
switch (pollResult)
{
case -1: // Error
- throw armnn::RuntimeException(std::string("Read failure from socket: ") + strerror(errno));
+ throw RuntimeException(std::string("Read failure from socket: ") + strerror(errno));
case 0: // Timeout
- throw armnn::RuntimeException("Timeout while reading from socket");
+ throw RuntimeException("Timeout while reading from socket");
default: // Normal poll return but it could still contain an error signal
// Check if the socket reported an error
if (m_Socket[0].revents & (POLLNVAL | POLLERR | POLLHUP))
{
- throw armnn::Exception(std::string("Socket 0 reported an error: ") + strerror(errno));
+ throw Exception(std::string("Socket 0 reported an error: ") + strerror(errno));
}
// Check if there is data to read
@@ -108,7 +108,7 @@ Packet SocketProfilingConnection::ReadPacket(uint32_t timeout)
if (8 != recv(m_Socket[0].fd, &header, sizeof(header), 0))
{
// What do we do here if there's not a valid 8 byte header to read?
- throw armnn::RuntimeException("The received packet did not contains a valid MIPE header");
+ throw RuntimeException("The received packet did not contains a valid MIPE header");
}
// stream_metadata_identifier is the first 4 bytes
@@ -133,7 +133,7 @@ Packet SocketProfilingConnection::ReadPacket(uint32_t timeout)
if (dataLength != static_cast<uint32_t>(receivedLength))
{
// What do we do here if we can't read in a full packet?
- throw armnn::RuntimeException("Invalid MIPE packet");
+ throw RuntimeException("Invalid MIPE packet");
}
return Packet(metadataIdentifier, dataLength, packetData);