Loading src/Examples/FileExample.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ int main() file.read( title2, 4); file.close(); if fileExists( "new-file.tnl" ) std::remove( "new-file.tnl" ); cout << "title2:" << title2 <<endl; } src/Examples/TimerExample.cpp +3 −0 Original line number Diff line number Diff line #include <iostream> #include <TNL/Timer.h> #include <unistd.h> using namespace TNL; using namespace std; int main() { unsigned int microseconds = 0.5; Timer time; time.start(); usleep(microseconds); time.stop(); time.getRealTime(); time.reset(); Loading src/TNL/File.h +14 −6 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ enum class IOMode const size_t FileGPUvsCPUTransferBufferSize = 5 * 2<<20; ///\brief Class file is aimed mainly for the binary data. ///\brief Class file is aimed mainly for saving and loading binary data. /// /// \par Example /// \include FileExample.cpp Loading @@ -59,10 +59,10 @@ class File public: /// Basic constructor. /// \brief Basic constructor. File(); /// Destructor. /// \brief Destructor. ~File(); ///// Loading Loading @@ -95,8 +95,12 @@ class File /// \brief Method that can write particular data type from given file into GPU. (Function that gets particular elements from given file.) /// /// Returns boolean value based on the succes in reading elements from given file. /// \param buffer Pointer in memory (where the read elements are stored?). /// Returns \e true when the elements are successfully read from given file. Otherwise returns \e false. /// /// \tparam Type Type of data. /// \tparam Device Place where data are stored after reading from file. For example Devices::Host or Devices::Cuda. /// \tparam Index Type of index by which the elements are indexed. /// \param buffer Pointer in memory where the elements are loaded and stored after reading. /// \param elements Number of elements the user wants to get (read) from given file. template< typename Type, typename Device = Devices::Host, typename Index = int > bool read( Type* buffer, Loading @@ -109,7 +113,11 @@ class File /// \brief Method that can write particular data type from CPU into given file. (Function that writes particular elements into given file.) /// /// Returns boolean value based on the succes in writing elements into given file. /// \param buffer Pointer in memory. /// /// \tparam Type Type of data. /// \tparam Device Place from where data are loaded before writing into file. For example Devices::Host or Devices::Cuda. /// \tparam Index Type of index by which the elements are indexed. /// \param buffer Pointer in memory from where the elements are loaded before writing into file. /// \param elements Number of elements the user wants to write into the given file. template< typename Type, typename Device = Devices::Host, typename Index = int > bool write( const Type* buffer, Loading src/TNL/Timer.h +7 −7 Original line number Diff line number Diff line Loading @@ -49,21 +49,21 @@ class Timer /// \brief Starts timer. /// /// Starts all time and cycle measurements such as real time, CPU time and /// CPU cycles. Function start() can be used also after using stop() function. /// CPU cycles. Method start() can be used also after using stop() method. /// The timer then continues measuring the time without reseting. void start(); ///// /// \brief Returns the elapsed time on given timer. /// /// It returns the elapsed time between calling the start() and stop() functions. /// Starts counting the real time after the function start() is called and /// pauses when the function stop() is called. /// It returns the elapsed time between calling the start() and stop() methods. /// Starts counting the real time after the method start() is called and /// pauses when the method stop() is called. /// If the timer have been started more then once without resetting, /// the real time is counted by adding all intervals (between start and stop /// functions) together. /// methods) together. /// This function can be called while the timer is running, there is no /// need to use stop() function first. /// need to use stop() method first. double getRealTime() const; ///// Loading @@ -86,7 +86,7 @@ class Timer /// \brief Function for measuring the real time. /// /// Returns the current calendar time. /// Returns number of seconds since Epoch, 1970-01-01 00:00:00 UTC. double readRealTime() const; /// \brief Function for measuring the CPU time. Loading Loading
src/Examples/FileExample.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ int main() file.read( title2, 4); file.close(); if fileExists( "new-file.tnl" ) std::remove( "new-file.tnl" ); cout << "title2:" << title2 <<endl; }
src/Examples/TimerExample.cpp +3 −0 Original line number Diff line number Diff line #include <iostream> #include <TNL/Timer.h> #include <unistd.h> using namespace TNL; using namespace std; int main() { unsigned int microseconds = 0.5; Timer time; time.start(); usleep(microseconds); time.stop(); time.getRealTime(); time.reset(); Loading
src/TNL/File.h +14 −6 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ enum class IOMode const size_t FileGPUvsCPUTransferBufferSize = 5 * 2<<20; ///\brief Class file is aimed mainly for the binary data. ///\brief Class file is aimed mainly for saving and loading binary data. /// /// \par Example /// \include FileExample.cpp Loading @@ -59,10 +59,10 @@ class File public: /// Basic constructor. /// \brief Basic constructor. File(); /// Destructor. /// \brief Destructor. ~File(); ///// Loading Loading @@ -95,8 +95,12 @@ class File /// \brief Method that can write particular data type from given file into GPU. (Function that gets particular elements from given file.) /// /// Returns boolean value based on the succes in reading elements from given file. /// \param buffer Pointer in memory (where the read elements are stored?). /// Returns \e true when the elements are successfully read from given file. Otherwise returns \e false. /// /// \tparam Type Type of data. /// \tparam Device Place where data are stored after reading from file. For example Devices::Host or Devices::Cuda. /// \tparam Index Type of index by which the elements are indexed. /// \param buffer Pointer in memory where the elements are loaded and stored after reading. /// \param elements Number of elements the user wants to get (read) from given file. template< typename Type, typename Device = Devices::Host, typename Index = int > bool read( Type* buffer, Loading @@ -109,7 +113,11 @@ class File /// \brief Method that can write particular data type from CPU into given file. (Function that writes particular elements into given file.) /// /// Returns boolean value based on the succes in writing elements into given file. /// \param buffer Pointer in memory. /// /// \tparam Type Type of data. /// \tparam Device Place from where data are loaded before writing into file. For example Devices::Host or Devices::Cuda. /// \tparam Index Type of index by which the elements are indexed. /// \param buffer Pointer in memory from where the elements are loaded before writing into file. /// \param elements Number of elements the user wants to write into the given file. template< typename Type, typename Device = Devices::Host, typename Index = int > bool write( const Type* buffer, Loading
src/TNL/Timer.h +7 −7 Original line number Diff line number Diff line Loading @@ -49,21 +49,21 @@ class Timer /// \brief Starts timer. /// /// Starts all time and cycle measurements such as real time, CPU time and /// CPU cycles. Function start() can be used also after using stop() function. /// CPU cycles. Method start() can be used also after using stop() method. /// The timer then continues measuring the time without reseting. void start(); ///// /// \brief Returns the elapsed time on given timer. /// /// It returns the elapsed time between calling the start() and stop() functions. /// Starts counting the real time after the function start() is called and /// pauses when the function stop() is called. /// It returns the elapsed time between calling the start() and stop() methods. /// Starts counting the real time after the method start() is called and /// pauses when the method stop() is called. /// If the timer have been started more then once without resetting, /// the real time is counted by adding all intervals (between start and stop /// functions) together. /// methods) together. /// This function can be called while the timer is running, there is no /// need to use stop() function first. /// need to use stop() method first. double getRealTime() const; ///// Loading @@ -86,7 +86,7 @@ class Timer /// \brief Function for measuring the real time. /// /// Returns the current calendar time. /// Returns number of seconds since Epoch, 1970-01-01 00:00:00 UTC. double readRealTime() const; /// \brief Function for measuring the CPU time. Loading