Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tnl-dev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
TNL
tnl-dev
Commits
c144d985
There was an error fetching the commit references. Please try again later.
Commit
c144d985
authored
6 years ago
by
Nina Džugasová
Committed by
Tomáš Oberhuber
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Documentation of Timer.
parent
b570813c
No related branches found
No related tags found
1 merge request
!15
Nina
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/Examples/StringExample.out
+1
-1
1 addition, 1 deletion
src/Examples/StringExample.out
src/TNL/FileName.h
+8
-6
8 additions, 6 deletions
src/TNL/FileName.h
src/TNL/Timer.h
+42
-4
42 additions, 4 deletions
src/TNL/Timer.h
src/UnitTests/FileNameTest.cpp
+2
-1
2 additions, 1 deletion
src/UnitTests/FileNameTest.cpp
with
53 additions
and
12 deletions
src/Examples/StringExample.out
+
1
−
1
View file @
c144d985
...
@@ -5,7 +5,7 @@ str3: string
...
@@ -5,7 +5,7 @@ str3: string
str4: 28.4 //string type
str4: 28.4 //string type
//functions
//functions
size of string:
6
bytes
size of string:
8
bytes
alloc_size: 256
alloc_size: 256
memory: 512
memory: 512
setter: Something new
setter: Something new
...
...
This diff is collapsed.
Click to expand it.
src/TNL/FileName.h
+
8
−
6
View file @
c144d985
...
@@ -40,18 +40,20 @@ class FileName
...
@@ -40,18 +40,20 @@ class FileName
void
setFileNameBase
(
const
String
&
fileNameBase
);
void
setFileNameBase
(
const
String
&
fileNameBase
);
/// \brief Sets the extension of given file.
/// \brief Sets the extension of given file.
///
///
/// Sets \e extension as suffix of a file name.
/// 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
);
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.
/// 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
);
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.
/// @param digitsCount Integer - number of digits.
void
setDigitsCount
(
const
int
digitsCount
);
void
setDigitsCount
(
const
int
digitsCount
);
...
@@ -62,7 +64,7 @@ class FileName
...
@@ -62,7 +64,7 @@ class FileName
void
setDistributedSystemNodeId
(
const
Coordinates
&
nodeId
);
void
setDistributedSystemNodeId
(
const
Coordinates
&
nodeId
);
/// Creates appropriate name for given file.
/// Creates appropriate name for given file.
///
///
/// Creates particular file name using \e fileNameBase, \e digitsCount,
/// Creates particular file name using \e fileNameBase, \e digitsCount,
/// \e index and \e extension.
/// \e index and \e extension.
String
getFileName
();
String
getFileName
();
...
...
This diff is collapsed.
Click to expand it.
src/TNL/Timer.h
+
42
−
4
View file @
c144d985
...
@@ -15,32 +15,67 @@ namespace TNL {
...
@@ -15,32 +15,67 @@ namespace TNL {
class
Logger
;
class
Logger
;
/// \brief Class for time measuring
class
Timer
class
Timer
{
{
public:
public:
/////
/// \brief Basic constructor.
///
/// This function creates a new timer.
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
();
void
reset
();
////
/// \brief Stops timer.
///
/// Stops all time and cycle measurements such as real time, CPU time and CPU cycles.
void
stop
();
void
stop
();
/////
/// \brief Starts timer.
///
/// Starts all time and cycle measurements such as real time, CPU time and CPU cycles.
void
start
();
void
start
();
/// \brief Counts the real (clock) time starting after the function \c start() is called.
double
getRealTime
()
const
;
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
;
double
getCPUTime
()
const
;
/// Counts the number of CPU cycles (machine cycles).
unsigned
long
long
int
getCPUCycles
()
const
;
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
;
bool
writeLog
(
Logger
&
logger
,
int
logLevel
=
0
)
const
;
protected:
protected:
/// Function for reading the real time from timer.
double
readRealTime
()
const
;
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
;
double
readCPUTime
()
const
;
/// \brief Function for reading the number of CPU cycles (machine cycles).
unsigned
long
long
int
readCPUCycles
()
const
;
unsigned
long
long
int
readCPUCycles
()
const
;
...
@@ -48,7 +83,10 @@ class Timer
...
@@ -48,7 +83,10 @@ class Timer
initialCPUTime
,
totalCPUTime
;
initialCPUTime
,
totalCPUTime
;
unsigned
long
long
int
initialCPUCycles
,
totalCPUCycles
;
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
;
bool
stopState
;
inline
unsigned
long
long
rdtsc
()
const
inline
unsigned
long
long
rdtsc
()
const
...
...
This diff is collapsed.
Click to expand it.
src/UnitTests/FileNameTest.cpp
+
2
−
1
View file @
c144d985
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
#endif
#endif
#include
<TNL/FileName.h>
#include
<TNL/FileName.h>
#include
<TNL/String.h>
//
#include <TNL/String.h>
using
namespace
TNL
;
using
namespace
TNL
;
...
@@ -71,6 +71,7 @@ TEST( FileNameTest, AllTogether )
...
@@ -71,6 +71,7 @@ TEST( FileNameTest, AllTogether )
fname
.
setDigitsCount
(
3
);
fname
.
setDigitsCount
(
3
);
EXPECT_EQ
(
fname
.
getFileName
(),
"name008.tnl"
);
EXPECT_EQ
(
fname
.
getFileName
(),
"name008.tnl"
);
EXPECT_EQ
(
getFileExtension
(
fname
.
getFileName
()),
"tnl"
);
}
}
#endif
#endif
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment