Skip to content

Commit

Permalink
changed log directory and defining the variable in the interface file
Browse files Browse the repository at this point in the history
  • Loading branch information
haraldott committed Dec 10, 2017
1 parent b0017a2 commit 9440fd3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
9 changes: 5 additions & 4 deletions examples/tcp-stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <errno.h>
#include "ns3/flow-monitor-module.h"
#include "ns3/tcp-stream-helper.h"
#include "ns3/tcp-stream-interface.h"

template <typename T>
std::string ToString(T val)
Expand Down Expand Up @@ -223,15 +224,15 @@ main (int argc, char *argv[])
randPosAlloc->AssignStreams (simulationId);

// create folder so we can log the positions of the clients
const char * mylogsDir = ("mylogs/");
const char * mylogsDir = dashLogDirectory.c_str();
mkdir (mylogsDir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
const char * tobascoDir = ("mylogs/" + adaptationAlgo).c_str ();
const char * tobascoDir = (dashLogDirectory + adaptationAlgo).c_str ();
mkdir (tobascoDir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
const char * dir = ("mylogs/" + adaptationAlgo + "/" + ToString (numberOfClients) + "/").c_str();
const char * dir = (dashLogDirectory + adaptationAlgo + "/" + ToString (numberOfClients) + "/").c_str();
mkdir(dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);

std::ofstream clientPosLog;
std::string clientPos = "mylogs/" + adaptationAlgo + "/" + ToString (numberOfClients) + "/" + "sim" + ToString (simulationId) + "_" + "clientPos.txt";
std::string clientPos = dashLogDirectory + "/" + adaptationAlgo + "/" + ToString (numberOfClients) + "/" + "sim" + ToString (simulationId) + "_" + "clientPos.txt";
clientPosLog.open (clientPos.c_str());
NS_ASSERT_MSG (clientPosLog.is_open(), "Couldn't open clientPosLog file");

Expand Down
12 changes: 6 additions & 6 deletions model/tcp-stream-client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -603,32 +603,32 @@ TcpStreamClient::InitializeLogFiles (std::string simulationId, std::string clien
{
NS_LOG_FUNCTION (this);

std::string dLog = "mylogs/" + m_algoName + "/" + numberOfClients + "/sim" + simulationId + "_" + "cl" + clientId + "_" + "downloadLog.txt";
std::string dLog = dashLogDirectory + m_algoName + "/" + numberOfClients + "/sim" + simulationId + "_" + "cl" + clientId + "_" + "downloadLog.txt";
downloadLog.open (dLog.c_str ());
downloadLog << "Segment_Index Download_Request_Sent Download_Start Download_End Segment_Size Download_OK\n";
downloadLog.flush ();

std::string pLog = "mylogs/" + m_algoName + "/" + numberOfClients + "/sim" + simulationId + "_" + "cl" + clientId + "_" + "playbackLog.txt";
std::string pLog = dashLogDirectory + m_algoName + "/" + numberOfClients + "/sim" + simulationId + "_" + "cl" + clientId + "_" + "playbackLog.txt";
playbackLog.open (pLog.c_str ());
playbackLog << "Segment_Index Playback_Start Quality_Level\n";
playbackLog.flush ();

std::string aLog = "mylogs/" + m_algoName + "/" + numberOfClients + "/sim" + simulationId + "_" + "cl" + clientId + "_" + "adaptationLog.txt";
std::string aLog = dashLogDirectory + m_algoName + "/" + numberOfClients + "/sim" + simulationId + "_" + "cl" + clientId + "_" + "adaptationLog.txt";
adaptationLog.open (aLog.c_str ());
adaptationLog << "Segment_Index Rep_Level Decision_Point_Of_Time Case DelayCase\n";
adaptationLog.flush ();

std::string bLog = "mylogs/" + m_algoName + "/" + numberOfClients + "/sim" + simulationId + "_" + "cl" + clientId + "_" + "bufferLog.txt";
std::string bLog = dashLogDirectory + m_algoName + "/" + numberOfClients + "/sim" + simulationId + "_" + "cl" + clientId + "_" + "bufferLog.txt";
bufferLog.open (bLog.c_str ());
bufferLog << " Time_Now Buffer_Level \n";
bufferLog.flush ();

std::string tLog = "mylogs/" + m_algoName + "/" + numberOfClients + "/sim" + simulationId + "_" + "cl" + clientId + "_" + "throughputLog.txt";
std::string tLog = dashLogDirectory + m_algoName + "/" + numberOfClients + "/sim" + simulationId + "_" + "cl" + clientId + "_" + "throughputLog.txt";
throughputLog.open (tLog.c_str ());
throughputLog << " Time_Now Bytes Received \n";
throughputLog.flush ();

std::string buLog = "mylogs/" + m_algoName + "/" + numberOfClients + "/sim" + simulationId + "_" + "cl" + clientId + "_" + "bufferUnderrunLog.txt";
std::string buLog = dashLogDirectory + m_algoName + "/" + numberOfClients + "/sim" + simulationId + "_" + "cl" + clientId + "_" + "bufferUnderrunLog.txt";
bufferUnderrunLog.open (buLog.c_str ());
bufferUnderrunLog << ("Buffer_Underrun_Started_At Until \n");
bufferUnderrunLog.flush ();
Expand Down
3 changes: 2 additions & 1 deletion model/tcp-stream-interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
#ifndef TCP_STREAM_INTERFACE_H
#define TCP_STREAM_INTERFACE_H


namespace ns3 {

std::string const dashLogDirectory = "dash-log-files/";

/*! \class algorithmReply tcp-stream-interface.h "model/tcp-stream-interface.h"
* \ingroup tcpStream
* \brief This struct contains the reply an adaptation algorithm returns to the client
Expand Down

0 comments on commit 9440fd3

Please sign in to comment.