Loading src/Examples/StringExample.out +1 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ str3: string str4: 28.4 //string type //functions size of string: 6 bytes size of string: 8 bytes alloc_size: 256 memory: 512 setter: Something new Loading src/TNL/FileName.h +8 −6 Original line number Diff line number Diff line Loading @@ -42,16 +42,18 @@ class FileName /// \brief Sets the extension of given file. /// /// Sets \e extension as suffix of a file name. /// @param extension String that specifies extension of file (without dot). Suffix of a file name. E.g. doc, xls, tnl. /// @param extension String that specifies extension of file (without dot). /// Suffix of a file name. E.g. doc, xls, tnl. void setExtension( const String& extension ); // \brief Sets index for given file. /// \brief Sets index for given file. /// /// Sets \e index after the base name of given file. /// @param index Integer - number of maximum 5(default) digits. (Number of digits can be changed with \c setDigitsCount). /// @param index Integer - number of maximum 5(default) digits. /// (Number of digits can be changed with \c setDigitsCount). void setIndex( const int index ); // \brief Sets number of digits for index of given file. /// \brief Sets number of digits for index of given file. /// /// @param digitsCount Integer - number of digits. void setDigitsCount( const int digitsCount ); Loading src/TNL/Timer.h +42 −4 Original line number Diff line number Diff line Loading @@ -15,32 +15,67 @@ namespace TNL { class Logger; /// \brief Class for time measuring class Timer { public: ///// /// \brief Basic constructor. /// /// This function creates a new timer. Timer(); ///// /// \brief Resets timer. /// /// Resets all time and cycle measurements such as real time, CPU time and CPU cycles. /// Sets all of them to zero. void reset(); //// /// \brief Stops timer. /// /// Stops all time and cycle measurements such as real time, CPU time and CPU cycles. void stop(); ///// /// \brief Starts timer. /// /// Starts all time and cycle measurements such as real time, CPU time and CPU cycles. void start(); /// \brief Counts the real (clock) time starting after the function \c start() is called. double getRealTime() const; ///// /// \brief Measures the CPU time. /// /// CPU time is the time that measures how long it takes processor /// to complete all computations. double getCPUTime() const; /// Counts the number of CPU cycles (machine cycles). unsigned long long int getCPUCycles() const; /// \brief Writes a record to the \e logger. /// /// \param logger /// \param logLevel bool writeLog( Logger& logger, int logLevel = 0 ) const; protected: /// Function for reading the real time from timer. double readRealTime() const; /// \brief Function for reading the CPU time from timer. /// /// CPU time is the time that measures how long it takes processor /// to complete all computations. double readCPUTime() const; /// \brief Function for reading the number of CPU cycles (machine cycles). unsigned long long int readCPUCycles() const; Loading @@ -49,6 +84,9 @@ class Timer unsigned long long int initialCPUCycles, totalCPUCycles; /// \brief Saves information about state of the timer. /// /// Knows whether the timer is currently stopped or not. bool stopState; inline unsigned long long rdtsc() const Loading src/UnitTests/FileNameTest.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ #endif #include <TNL/FileName.h> #include <TNL/String.h> // #include <TNL/String.h> using namespace TNL; Loading Loading @@ -71,6 +71,7 @@ TEST( FileNameTest, AllTogether ) fname.setDigitsCount(3); EXPECT_EQ( fname.getFileName(), "name008.tnl" ); EXPECT_EQ( getFileExtension(fname.getFileName()), "tnl" ); } #endif Loading Loading
src/Examples/StringExample.out +1 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ str3: string str4: 28.4 //string type //functions size of string: 6 bytes size of string: 8 bytes alloc_size: 256 memory: 512 setter: Something new Loading
src/TNL/FileName.h +8 −6 Original line number Diff line number Diff line Loading @@ -42,16 +42,18 @@ class FileName /// \brief Sets the extension of given file. /// /// Sets \e extension as suffix of a file name. /// @param extension String that specifies extension of file (without dot). Suffix of a file name. E.g. doc, xls, tnl. /// @param extension String that specifies extension of file (without dot). /// Suffix of a file name. E.g. doc, xls, tnl. void setExtension( const String& extension ); // \brief Sets index for given file. /// \brief Sets index for given file. /// /// Sets \e index after the base name of given file. /// @param index Integer - number of maximum 5(default) digits. (Number of digits can be changed with \c setDigitsCount). /// @param index Integer - number of maximum 5(default) digits. /// (Number of digits can be changed with \c setDigitsCount). void setIndex( const int index ); // \brief Sets number of digits for index of given file. /// \brief Sets number of digits for index of given file. /// /// @param digitsCount Integer - number of digits. void setDigitsCount( const int digitsCount ); Loading
src/TNL/Timer.h +42 −4 Original line number Diff line number Diff line Loading @@ -15,32 +15,67 @@ namespace TNL { class Logger; /// \brief Class for time measuring class Timer { public: ///// /// \brief Basic constructor. /// /// This function creates a new timer. Timer(); ///// /// \brief Resets timer. /// /// Resets all time and cycle measurements such as real time, CPU time and CPU cycles. /// Sets all of them to zero. void reset(); //// /// \brief Stops timer. /// /// Stops all time and cycle measurements such as real time, CPU time and CPU cycles. void stop(); ///// /// \brief Starts timer. /// /// Starts all time and cycle measurements such as real time, CPU time and CPU cycles. void start(); /// \brief Counts the real (clock) time starting after the function \c start() is called. double getRealTime() const; ///// /// \brief Measures the CPU time. /// /// CPU time is the time that measures how long it takes processor /// to complete all computations. double getCPUTime() const; /// Counts the number of CPU cycles (machine cycles). unsigned long long int getCPUCycles() const; /// \brief Writes a record to the \e logger. /// /// \param logger /// \param logLevel bool writeLog( Logger& logger, int logLevel = 0 ) const; protected: /// Function for reading the real time from timer. double readRealTime() const; /// \brief Function for reading the CPU time from timer. /// /// CPU time is the time that measures how long it takes processor /// to complete all computations. double readCPUTime() const; /// \brief Function for reading the number of CPU cycles (machine cycles). unsigned long long int readCPUCycles() const; Loading @@ -49,6 +84,9 @@ class Timer unsigned long long int initialCPUCycles, totalCPUCycles; /// \brief Saves information about state of the timer. /// /// Knows whether the timer is currently stopped or not. bool stopState; inline unsigned long long rdtsc() const Loading
src/UnitTests/FileNameTest.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ #endif #include <TNL/FileName.h> #include <TNL/String.h> // #include <TNL/String.h> using namespace TNL; Loading Loading @@ -71,6 +71,7 @@ TEST( FileNameTest, AllTogether ) fname.setDigitsCount(3); EXPECT_EQ( fname.getFileName(), "name008.tnl" ); EXPECT_EQ( getFileExtension(fname.getFileName()), "tnl" ); } #endif Loading