Skip to content
Snippets Groups Projects
Commit faf33082 authored by Armando Luiz Nicolini Delgado's avatar Armando Luiz Nicolini Delgado :nerd:
Browse files

/* Correção em 'markerName()'.

   Acréscimo de comentários em 'utils.c'
*/
parent 370e8641
Branches
No related tags found
No related merge requests found
...@@ -21,9 +21,14 @@ double timestamp(void) ...@@ -21,9 +21,14 @@ double timestamp(void)
return((double)(tp.tv_sec*1.0e3 + tp.tv_nsec*1.0e-6)); 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 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); sprintf(mark, "%s_%u", baseName,n);
...@@ -34,6 +39,10 @@ string_t markerName(string_t baseName, int 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 isPot2(int n)
{ {
int k; int k;
......
...@@ -14,11 +14,11 @@ typedef char * string_t; ...@@ -14,11 +14,11 @@ typedef char * string_t;
#define ALIGN_32 __attribute__((aligned(32))) #define ALIGN_32 __attribute__((aligned(32)))
#define ALIGN_16 __attribute__((aligned(16))) #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); double timestamp(void);
string_t markerName(string_t baseName, int n); string_t markerName(string_t baseName, int n);
// int isPot2 (int n);
#define isPot2(n) (n && !(n & (n - 1)))
#endif // __UTILS_H__ #endif // __UTILS_H__
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment