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
faf33082
Commit
faf33082
authored
3 years ago
by
Armando Luiz Nicolini Delgado
Browse files
Options
Downloads
Patches
Plain Diff
/* Correção em 'markerName()'.
Acréscimo de comentários em 'utils.c' */
parent
370e8641
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
utils/utils.c
+10
-1
10 additions, 1 deletion
utils/utils.c
utils/utils.h
+3
-3
3 additions, 3 deletions
utils/utils.h
with
13 additions
and
4 deletions
utils/utils.c
+
10
−
1
View file @
faf33082
...
...
@@ -21,9 +21,14 @@ double timestamp(void)
return
((
double
)(
tp
.
tv_sec
*
1.0e3
+
tp
.
tv_nsec
*
1.0e-6
));
}
/* Gera string '<baseName>_n'
* Por exemplo, se baseName = "ABC" e n = 10,
* Função retorna a string "ABC_10"
* Útil para gerar marcadores para LIKWID
*/
string_t
markerName
(
string_t
baseName
,
int
n
)
{
string_t
mark
=
(
string_t
)
malloc
(
(
strlen
(
baseName
)
+
1
)
+
(
log10
(
n
)
+
1
)
+
1
);
string_t
mark
=
(
string_t
)
malloc
(
(
strlen
(
baseName
)
+
1
)
+
(
(
int
)
log10
(
n
)
+
1
)
+
1
);
sprintf
(
mark
,
"%s_%u"
,
baseName
,
n
);
...
...
@@ -34,6 +39,10 @@ string_t markerName(string_t baseName, int n)
}
/*
// Retorna TRUE se 'n' é uma potência de 2
// [OBSOLETO]
// Definida macro em 'utils.h' para substituir esta função
//
int isPot2(int n)
{
int k;
...
...
This diff is collapsed.
Click to expand it.
utils/utils.h
+
3
−
3
View file @
faf33082
...
...
@@ -14,11 +14,11 @@ typedef char * string_t;
#define ALIGN_32 __attribute__((aligned(32)))
#define ALIGN_16 __attribute__((aligned(16)))
// Macro para verificar de valor 'n' é potência de 2 ou não
#define isPot2(n) (n && !(n & (n - 1)))
double
timestamp
(
void
);
string_t
markerName
(
string_t
baseName
,
int
n
);
// int isPot2 (int n);
#define isPot2(n) (n && !(n & (n - 1)))
#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