-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b61c12e
commit 50b49c5
Showing
4 changed files
with
62 additions
and
1 deletion.
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,30 @@ | ||
|
||
project(mem_profile C) | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_INSTALL_PREFIX}/lib/cmake") | ||
|
||
file(GLOB PROFILE_SRC | ||
"*.c" | ||
) | ||
|
||
set(PROFILE_PROJECT_NAME mem_profile) | ||
add_executable(${PROFILE_PROJECT_NAME} ${PROFILE_SRC}) | ||
aws_set_common_properties(${PROFILE_PROJECT_NAME}) | ||
|
||
|
||
target_include_directories(${PROFILE_PROJECT_NAME} PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:include>) | ||
|
||
target_link_libraries(${PROFILE_PROJECT_NAME} PRIVATE aws-c-common) | ||
|
||
if (BUILD_SHARED_LIBS AND NOT WIN32) | ||
message(INFO " mem_profile will be built with shared libs, but you may need to set LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib to run the application") | ||
endif() | ||
|
||
install(TARGETS ${PROFILE_PROJECT_NAME} | ||
EXPORT ${PROFILE_PROJECT_NAME}-targets | ||
COMPONENT Runtime | ||
RUNTIME | ||
DESTINATION bin | ||
COMPONENT Runtime) |
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,30 @@ | ||
/** | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
|
||
#include <aws/common/byte_buf.h> | ||
#include <aws/common/clock.h> | ||
#include <aws/common/device_random.h> | ||
|
||
#include <inttypes.h> | ||
|
||
static size_t part_size = 8 * 1024 * 1024; | ||
|
||
int main(void) { | ||
struct aws_allocator *allocator = aws_default_allocator(); | ||
aws_common_library_init(allocator); | ||
|
||
struct aws_byte_buf bufs[100]; | ||
for (size_t i = 0; i < 100; ++i) { | ||
aws_byte_buf_init(&bufs[i], allocator, part_size); | ||
aws_device_random_buffer(&bufs[i]); | ||
} | ||
|
||
for (size_t i = 0; i < 100; ++i) { | ||
aws_byte_buf_clean_up(&bufs[i]); | ||
} | ||
|
||
aws_common_library_clean_up(); | ||
return 0; | ||
} |
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