-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Current reproducer for Caliper vs Variorum energy reporting
- Loading branch information
Showing
3 changed files
with
65 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright (c) 2015-2022, Lawrence Livermore National Security, LLC. | ||
// See top-level LICENSE file for details. | ||
|
||
// A C Caliper instrumentation and ConfigManager example | ||
|
||
// Usage: $ cali-basic-annotations <configuration-string> | ||
// For example, "$ cali-basic-annotations runtime-report" will print a | ||
// hierarchical runtime summary for all annotated regions. | ||
|
||
#include <caliper/cali.h> | ||
|
||
#include <stdio.h> | ||
#include <unistd.h> | ||
#include <string.h> | ||
|
||
void bar() | ||
{ | ||
printf("I'm in BAR, I doze off for a second.\n"); | ||
CALI_MARK_FUNCTION_BEGIN; | ||
sleep(1); | ||
CALI_MARK_FUNCTION_END; | ||
printf("Exit BAR. \n"); | ||
} | ||
|
||
void foo() | ||
{ | ||
// A function annotation. Opens region "function=foo" in Caliper, | ||
// and automatically closes it at the end of the function. | ||
printf("I'm in a FOO, I work hard!\n"); | ||
CALI_MARK_FUNCTION_BEGIN; | ||
long double res=0.1; | ||
int i; | ||
for (i=0;i<1000000;i++) | ||
res += res * i; | ||
CALI_MARK_FUNCTION_END; | ||
printf("Exit FOO. \n"); | ||
} | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
// Mark begin of the current function. Must be manually closed. | ||
// Opens region "function=main" in Caliper. | ||
printf("Hello World\n"); | ||
CALI_MARK_FUNCTION_BEGIN; | ||
//foo(); | ||
//bar(); | ||
// Mark the end of the "function=main" region. | ||
CALI_MARK_FUNCTION_END; | ||
printf("Exit Main.\n"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters