forked from Xilinx/XRT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Capture and Replay: XBTRACER module inclusion (Xilinx#8466)
* Added xbtracer launcher application This application for now launches the executabled passed to it as argument ex. xbtracer -v "Debug/opt/xilinx/xrt/bin/xrt-smi --help" Signed-off-by: Harsh Wardhan <[email protected]> * Added logger module. This module provide infra to trace the APIs and data. Traces(.txt and .bin) are written into seperate directory based on execution timestamp. Signed-off-by: Harsh Wardhan <[email protected]> * Added interception support for linux platform few APIs from xrt::device has been instrumented in this commit other required infrastructure for linux platform has been fully commited. Signed-off-by: Harsh Wardhan <[email protected]> * Added interception support for windows platform Signed-off-by: Harsh Wardhan <[email protected]> * Added instrumentation wrapper for other APIs extended instrumentation to other APIs planned for tracing Signed-off-by: Harsh Wardhan <[email protected]> --------- Signed-off-by: Harsh Wardhan <[email protected]> Co-authored-by: rajiv448 <[email protected]>
- Loading branch information
1 parent
4e009c4
commit 266b98d
Showing
26 changed files
with
3,638 additions
and
0 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,44 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved | ||
# ----------------------------------------------------------------------------- | ||
# Include the generated header files (e.g., version.h) | ||
include_directories(${XRT_BINARY_DIR}/gen) | ||
|
||
set(XBTRACER_NAME "xbtracer") | ||
|
||
if(WIN32) | ||
set(XRT_HELPER_SCRIPTS "xbtracer" "xbtracer.bat") | ||
else() | ||
set(XRT_HELPER_SCRIPTS "xbtracer") | ||
endif() | ||
|
||
set(SRCS src/app/launcher.cpp) | ||
if (WIN32) | ||
list(APPEND SRCS src/app/getopt.c) | ||
endif() | ||
|
||
add_executable(${XBTRACER_NAME} ${SRCS}) | ||
|
||
# Static build is a Linux / Ubuntu option only | ||
if (XRT_STATIC_BUILD) | ||
add_executable(${XBTRACER_NAME}_static ${SRCS}) | ||
target_link_options(${XBTRACER_NAME}_static PRIVATE "-static" "-L${Boost_LIBRARY_DIRS}") | ||
# Bypass FindBoost versions and just link explicitly with boost libraries | ||
# The -static link option will pick the static libraries. | ||
target_link_libraries(${XBTRACER_NAME}_static | ||
PRIVATE | ||
xrt_coreutil_static | ||
boost_system | ||
boost_program_options | ||
-Wl,--whole-archive rt pthread -Wl,--no-whole-archive | ||
uuid | ||
dl | ||
) | ||
set_target_properties(${XBTRACER_NAME}_static PROPERTIES INSTALL_RPATH "") | ||
install(TARGETS ${XBTRACER_NAME}_static RUNTIME DESTINATION ${XRT_INSTALL_UNWRAPPED_DIR}) | ||
endif() | ||
|
||
install (TARGETS ${XBTRACER_NAME} RUNTIME DESTINATION ${XRT_INSTALL_UNWRAPPED_DIR}) | ||
install (PROGRAMS ${XRT_HELPER_SCRIPTS} DESTINATION ${XRT_INSTALL_BIN_DIR}) | ||
|
||
add_subdirectory(src/lib) |
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,51 @@ | ||
/* ***************************************************************** | ||
* | ||
* Copyright 2016 Microsoft | ||
* | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
******************************************************************/ | ||
|
||
#include "getopt.h" | ||
#include <windows.h> | ||
|
||
char* optarg = NULL; | ||
int optind = 1; | ||
|
||
int getopt(int argc, char *const argv[], const char *optstring) | ||
{ | ||
if ((optind >= argc) || (argv[optind][0] != '-') || (argv[optind][0] == 0)) | ||
{ | ||
return -1; | ||
} | ||
|
||
int opt = argv[optind++][1]; | ||
const char *p = strchr(optstring, opt); | ||
|
||
if (p == NULL) | ||
{ | ||
return '?'; | ||
} | ||
if (p[1] == ':') | ||
{ | ||
//optind++; | ||
if (optind >= argc) | ||
{ | ||
return '?'; | ||
} | ||
optarg = argv[optind]; | ||
optind++; | ||
} | ||
return opt; | ||
} |
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,36 @@ | ||
/* ***************************************************************** | ||
* | ||
* Copyright 2016 Microsoft | ||
* | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
******************************************************************/ | ||
|
||
#ifndef GETOPT_H__ | ||
#define GETOPT_H__ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
extern char *optarg; | ||
extern int optind; | ||
|
||
int getopt(int argc, char *const argv[], const char *optstring); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
Oops, something went wrong.