Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CI1164 - Utils
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Armando Luiz Nicolini Delgado
CI1164 - Utils
Commits
c38ab04b
Commit
c38ab04b
authored
3 years ago
by
Armando Luiz Nicolini Delgado
Browse files
Options
Downloads
Patches
Plain Diff
* Adicionada função 'markerName' para gerar nomes de marcadores LIKWID
parent
2352e750
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
utils/alt/utils-01.c
+15
-0
15 additions, 0 deletions
utils/alt/utils-01.c
utils/alt/utils-01.h
+6
-0
6 additions, 0 deletions
utils/alt/utils-01.h
utils/utils.c
+18
-4
18 additions, 4 deletions
utils/utils.c
utils/utils.h
+7
-1
7 additions, 1 deletion
utils/utils.h
with
46 additions
and
5 deletions
utils/alt/utils-01.c
+
15
−
0
View file @
c38ab04b
#include
<stdio.h>
#include
<string.h>
#include
<math.h>
#include
"utils.h"
...
...
@@ -18,3 +20,16 @@ double timestamp(void)
clock_gettime
(
CLOCK_MONOTONIC_RAW
,
&
tp
);
return
((
double
)(
tp
.
tv_sec
*
1.0e3
+
tp
.
tv_nsec
*
1.0e-6
));
}
string_t
markerName
(
string_t
baseName
,
int
n
)
{
string_t
mark
=
(
string_t
)
malloc
(
(
strlen
(
baseName
)
+
1
)
+
(
log10
(
n
)
+
1
)
+
1
);
sprintf
(
mark
,
"%s_%u"
,
baseName
,
n
);
// printf("*** %s\n", mark);
return
mark
;
}
This diff is collapsed.
Click to expand it.
utils/alt/utils-01.h
+
6
−
0
View file @
c38ab04b
...
...
@@ -4,7 +4,13 @@
#include
<stdlib.h>
#include
<time.h>
typedef
double
real_t
;
typedef
double
rtime_t
;
typedef
char
*
string_t
;
double
timestamp
(
void
);
string_t
markerName
(
string_t
baseName
,
int
n
);
#endif // __UTILS_H__
This diff is collapsed.
Click to expand it.
utils/utils.c
+
18
−
4
View file @
c38ab04b
#include
<stdio.h>
#include
<string.h>
#include
<math.h>
#include
"utils.h"
/* Retorna tempo em milisegundos
...
...
@@ -13,9 +16,20 @@
double
timestamp
(
void
)
{
struct
timeval
tp
;
gettimeofday
(
&
tp
,
NULL
);
// printf("\n*** %7.10lf ms %7.10lf ms\n", tp.tv_sec*1.0e3, tp.tv_usec*1.0e-3);
return
((
double
)(
tp
.
tv_sec
*
1.0e3
+
tp
.
tv_usec
*
1.0e-3
));
struct
timespec
tp
;
clock_gettime
(
CLOCK_MONOTONIC_RAW
,
&
tp
);
return
((
double
)(
tp
.
tv_sec
*
1.0e3
+
tp
.
tv_nsec
*
1.0e-6
));
}
string_t
markerName
(
string_t
baseName
,
int
n
)
{
string_t
mark
=
(
string_t
)
malloc
(
(
strlen
(
baseName
)
+
1
)
+
(
log10
(
n
)
+
1
)
+
1
);
sprintf
(
mark
,
"%s_%u"
,
baseName
,
n
);
// printf("*** %s\n", mark);
return
mark
;
}
This diff is collapsed.
Click to expand it.
utils/utils.h
+
7
−
1
View file @
c38ab04b
...
...
@@ -2,9 +2,15 @@
#define __UTILS_H__
#include
<stdlib.h>
#include
<sys/time.h>
#include
<time.h>
typedef
double
real_t
;
typedef
double
rtime_t
;
typedef
char
*
string_t
;
double
timestamp
(
void
);
string_t
markerName
(
string_t
baseName
,
int
n
);
#endif // __UTILS_H__
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