Skip to content

Commit

Permalink
Merge branch 'master' into dev_python_ittapi
Browse files Browse the repository at this point in the history
  • Loading branch information
eparshut authored Jun 19, 2024
2 parents d744bcb + 1d92c61 commit 5a7ecd6
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 159 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ jobs:
if: runner.os == 'Linux'
run: sudo apt-get install gcc-multilib
- name: Build C library
run: python buildall.py -pt -v
run: python buildall.py ${{ runner.os != 'macOS' && '-pt -v' || '-v' }}
- name: Display structure of files
run: ls -R
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
with:
name: build-artifacts
name: build-artifacts-${{ matrix.os }}
path: build*/**/bin

create_release:
Expand All @@ -53,6 +53,10 @@ jobs:
prerelease: false
- name: Download Artifacts
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
with:
path: build-artifacts
pattern: build-artifacts-*
merge-multiple: true
- name: Display structure of downloaded files
run: ls -R
- name: Zip files
Expand Down
12 changes: 2 additions & 10 deletions include/AdvisorAnnotate.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
// SAMPLE SOURCE CODE - SUBJECT TO THE TERMS OF END-USER LICENSE AGREEMENT
// FOR INTEL(R) ADVISOR XE 2018.
//
// Copyright (c) 2012-2017 Intel Corporation. All rights reserved.
//
// THIS FILE IS PROVIDED "AS IS" WITH NO WARRANTIES, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTY OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT OF INTELLECTUAL
// PROPERTY RIGHTS.
//
// Copyright (C) 2012-2017 Intel Corporation
// SPDX-License-Identifier: GPL-2.0-only OR BSD-3-Clause

// This file defines functions used by the Intel(R) Advisor XE
// "Dependencies Modeling" and "Suitability Modeling" analysis, which
Expand Down
14 changes: 2 additions & 12 deletions include/fortran/advisor_annotate.f90
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
! ========================================================================
!
! SAMPLE SOURCE CODE - SUBJECT TO THE TERMS OF END-USER LICENSE AGREEMENT
! FOR INTEL(R) ADVISOR XE 2018.
!
! Copyright (c) 2012-2017 Intel Corporation. All rights reserved.
!
! THIS FILE IS PROVIDED "AS IS" WITH NO WARRANTIES, EXPRESS OR IMPLIED,
! INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTY OF MERCHANTABILITY,
! FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT OF INTELLECTUAL
! PROPERTY RIGHTS.
!
! Copyright (C) 2012-2017 Intel Corporation
! SPDX-License-Identifier: GPL-2.0-only OR BSD-3-Clause
! ========================================================================
!

!--------
!
Expand Down
60 changes: 2 additions & 58 deletions include/fortran/posix/ittnotify.f90
Original file line number Diff line number Diff line change
@@ -1,63 +1,7 @@
! ========================================================================
! <copyright>
! This file is provided under a dual BSD/GPLv2 license. When using or
! redistributing this file, you may do so under either license.
!
! GPL LICENSE SUMMARY
!
! Copyright (c) 2005-2017 Intel Corporation. All rights reserved.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of version 2 of the GNU General Public License as
! published by the Free Software Foundation.
!
! This program is distributed in the hope that it will be useful, but
! WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
! General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with this program; if not, write to the Free Software
! Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
! The full GNU General Public License is included in this distribution
! in the file called LICENSE.GPL.
!
! Contact Information:
! http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
!
! BSD LICENSE
!
! Copyright (c) 2005-2017 Intel Corporation. All rights reserved.
! All rights reserved.
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
!
! * Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! * Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions and the following disclaimer in
! the documentation and/or other materials provided with the
! distribution.
! * Neither the name of Intel Corporation nor the names of its
! contributors may be used to endorse or promote products derived
! from this software without specific prior written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
! A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
! OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
! LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
! THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
! OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! </copyright>
! Copyright (C) 2005-2017 Intel Corporation
! SPDX-License-Identifier: GPL-2.0-only OR BSD-3-Clause
! ========================================================================
!

!--------
!
Expand Down
60 changes: 2 additions & 58 deletions include/fortran/win32/ittnotify.f90
Original file line number Diff line number Diff line change
@@ -1,63 +1,7 @@
! ========================================================================
! <copyright>
! This file is provided under a dual BSD/GPLv2 license. When using or
! redistributing this file, you may do so under either license.
!
! GPL LICENSE SUMMARY
!
! Copyright (c) 2005-2017 Intel Corporation. All rights reserved.
!
! This program is free software; you can redistribute it and/or modify
! it under the terms of version 2 of the GNU General Public License as
! published by the Free Software Foundation.
!
! This program is distributed in the hope that it will be useful, but
! WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
! General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with this program; if not, write to the Free Software
! Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
! The full GNU General Public License is included in this distribution
! in the file called LICENSE.GPL.
!
! Contact Information:
! http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
!
! BSD LICENSE
!
! Copyright (c) 2005-2017 Intel Corporation. All rights reserved.
! All rights reserved.
!
! Redistribution and use in source and binary forms, with or without
! modification, are permitted provided that the following conditions
! are met:
!
! * Redistributions of source code must retain the above copyright
! notice, this list of conditions and the following disclaimer.
! * Redistributions in binary form must reproduce the above copyright
! notice, this list of conditions and the following disclaimer in
! the documentation and/or other materials provided with the
! distribution.
! * Neither the name of Intel Corporation nor the names of its
! contributors may be used to endorse or promote products derived
! from this software without specific prior written permission.
!
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
! A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
! OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
! LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
! THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
! OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! </copyright>
! Copyright (C) 2005-2017 Intel Corporation
! SPDX-License-Identifier: GPL-2.0-only OR BSD-3-Clause
! ========================================================================
!

!--------
!
Expand Down
11 changes: 6 additions & 5 deletions rust/integration-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ source vtune-vars.sh
cargo test
```

To install VTune, see the [User
Guide](https://www.intel.com/content/www/us/en/develop/documentation/vtune-help/top/installation.html).
The environment setup script (e.g., `vtune-vars.sh`) can be found within the VTune installation;
e.g., `$HOME/intel/oneapi/vtune/latest` or `/opt/intel/oneapi/vtune/latest` on
[Linux](https://www.intel.com/content/www/us/en/develop/documentation/get-started-with-vtune/top/linux-os.html).
To install VTune, see the [User Guide]. The environment setup script (e.g., `vtune-vars.sh`) can be
found within the VTune installation; e.g., `$HOME/intel/oneapi/vtune/latest` or
`/opt/intel/oneapi/vtune/latest` on [Linux].

[User Guide]: https://www.intel.com/content/www/us/en/docs/vtune-profiler/user-guide/current/installation.html
[Linux]: https://www.intel.com/content/www/us/en/docs/vtune-profiler/get-started-guide/current/linux-os.html
2 changes: 1 addition & 1 deletion rust/integration-tests/tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn run_with_collector() {

// Finally, check that the created report actually contains the measured tasks. It may be
// interesting to filter by task here: e.g.,
// https://www.intel.com/content/www/us/en/develop/documentation/vtune-help/top/command-line-interface/generating-command-line-reports/filtering-and-grouping-reports.html.
// https://www.intel.com/content/www/us/en/docs/vtune-profiler/user-guide/current/filtering-and-grouping-reports.html
let report_stdout = run(&["vtune", "-report", "summary", result_dir_flag]);
assert!(report_stdout.contains("task#1 "));
assert!(report_stdout.contains("task#2 "));
Expand Down
6 changes: 3 additions & 3 deletions rust/ittapi/src/collection_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
/// // Do finalization work here
/// ```
///
/// [Collection Control API]: https://www.intel.com/content/www/us/en/develop/documentation/vtune-help/top/api-support/instrumentation-and-tracing-technology-apis/instrumentation-tracing-technology-api-reference/collection-control-api.html
/// [Collection Control API]: https://www.intel.com/content/www/us/en/docs/vtune-profiler/user-guide/current/collection-control-api.html
pub fn pause() {
if let Some(pause_fn) = unsafe { ittapi_sys::__itt_pause_ptr__3_0 } {
unsafe { (pause_fn)() };
Expand All @@ -54,7 +54,7 @@ pub fn pause() {
///
/// See [pause#example].
///
/// [Collection Control API]: https://www.intel.com/content/www/us/en/develop/documentation/vtune-help/top/api-support/instrumentation-and-tracing-technology-apis/instrumentation-tracing-technology-api-reference/collection-control-api.html
/// [Collection Control API]: https://www.intel.com/content/www/us/en/docs/vtune-profiler/user-guide/current/collection-control-api.html
pub fn resume() {
if let Some(resume_fn) = unsafe { ittapi_sys::__itt_resume_ptr__3_0 } {
unsafe { (resume_fn)() };
Expand All @@ -72,7 +72,7 @@ pub fn resume() {
///
/// Detach behaves similarly to [pause#example].
///
/// [Collection Control API]: https://www.intel.com/content/www/us/en/develop/documentation/vtune-help/top/api-support/instrumentation-and-tracing-technology-apis/instrumentation-tracing-technology-api-reference/collection-control-api.html
/// [Collection Control API]: https://www.intel.com/content/www/us/en/docs/vtune-profiler/user-guide/current/collection-control-api.html
pub fn detach() {
if let Some(detach_fn) = unsafe { ittapi_sys::__itt_detach_ptr__3_0 } {
unsafe { (detach_fn)() };
Expand Down
4 changes: 2 additions & 2 deletions rust/ittapi/src/domain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::ffi::CString;
/// [Domain API] documentation for more information.
///
/// [Domain API]:
/// https://www.intel.com/content/www/us/en/develop/documentation/vtune-help/top/api-support/instrumentation-and-tracing-technology-apis/instrumentation-tracing-technology-api-reference/domain-api.html
/// https://www.intel.com/content/www/us/en/docs/vtune-profiler/user-guide/current/domain-api.html
pub struct Domain(*mut ittapi_sys::__itt_domain);
impl Domain {
/// Create a new domain. Note that, if the `ittnotify` library is not initialized, this call
Expand Down Expand Up @@ -41,7 +41,7 @@ impl Domain {
/// thread in the process.
///
/// [ITT documentation]:
/// https://www.intel.com/content/www/us/en/develop/documentation/vtune-help/top/api-support/instrumentation-and-tracing-technology-apis/instrumentation-tracing-technology-api-reference/domain-api.html
/// https://www.intel.com/content/www/us/en/docs/vtune-profiler/user-guide/current/domain-api.html
unsafe impl Sync for Domain {}

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion rust/ittapi/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{ffi::CString, marker::PhantomData};

/// See the [Event API] documentation.
///
/// [Event API]: https://www.intel.com/content/www/us/en/develop/documentation/vtune-help/top/api-support/instrumentation-and-tracing-technology-apis/instrumentation-tracing-technology-api-reference/event-api.html
/// [Event API]: https://www.intel.com/content/www/us/en/docs/vtune-profiler/user-guide/current/event-api.html
///
/// ```
/// let event = ittapi::Event::new("foo");
Expand Down
2 changes: 1 addition & 1 deletion rust/ittapi/src/jit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! is a high-level view of a subset of the full functionality available. See the [JIT Profiling
//! API] for more information.
//!
//! [JIT Profiling API]: https://www.intel.com/content/www/us/en/develop/documentation/vtune-help/top/api-support/jit-profiling-api.html
//! [JIT Profiling API]: https://www.intel.com/content/www/us/en/docs/vtune-profiler/user-guide/current/jit-profiling-api.html
use anyhow::Context;
use std::{ffi::CString, os, ptr};

Expand Down
2 changes: 1 addition & 1 deletion rust/ittapi/src/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl Region {
/// used for fine-grained profiling, such as [anomaly detection] (a preview feature of VTune).
///
/// [anomaly detection]:
/// https://www.intel.com/content/www/us/en/docs/vtune-profiler/user-guide/2024-1/anomaly-detection-analysis.html
/// https://www.intel.com/content/www/us/en/docs/vtune-profiler/user-guide/current/anomaly-detection-analysis.html
///
/// ```
/// # use ittapi::Region;
Expand Down
2 changes: 1 addition & 1 deletion rust/ittapi/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::ffi::CString;
/// documentation for more information.
///
/// [String Handle API]:
/// https://www.intel.com/content/www/us/en/develop/documentation/vtune-help/top/api-support/instrumentation-and-tracing-technology-apis/instrumentation-tracing-technology-api-reference/string-handle-api.html
/// https://www.intel.com/content/www/us/en/docs/vtune-profiler/user-guide/current/string-handle-api.html
#[derive(PartialEq, Eq, Debug)]
pub struct StringHandle(*mut ittapi_sys::__itt_string_handle);
impl StringHandle {
Expand Down
2 changes: 1 addition & 1 deletion rust/ittapi/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{domain::Domain, string::StringHandle};
/// A task is a logical unit of work performed by a particular thread. See the [Task API]
/// documentation for more information.
///
/// [Task API]: https://www.intel.com/content/www/us/en/develop/documentation/vtune-help/top/api-support/instrumentation-and-tracing-technology-apis/instrumentation-tracing-technology-api-reference/task-api.html
/// [Task API]: https://www.intel.com/content/www/us/en/docs/vtune-profiler/user-guide/current/task-api.html
///
/// ```
/// # use ittapi::{Domain, StringHandle, Task};
Expand Down
16 changes: 13 additions & 3 deletions src/ittnotify/jitprofiling.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,23 @@ ITT_EXTERN_C iJIT_IsProfilingActiveFlags JITAPI iJIT_IsProfilingActive()
}

#if ITT_PLATFORM == ITT_PLATFORM_WIN
static int isValidAbsolutePath(char *path)
static int isValidAbsolutePath(char *path, size_t maxPathLength)
{
if (path == NULL)
{
return 0;
}
else if (strlen(path) > 2)

size_t pathLength = strnlen(path, maxPathLength);
if (pathLength == maxPathLength)
{
/* The strnlen() function returns maxPathLength if there is no null terminating
* among the first maxPathLength characters in the string pointed to by path.
*/
return 0;
}

if (pathLength > 2)
{
if (isalpha(path[0]) && path[1] == ':' && path[2] == '\\')
{
Expand Down Expand Up @@ -179,7 +189,7 @@ static int loadiJIT_Funcs()
{
envret = GetEnvironmentVariableA(NEW_DLL_ENVIRONMENT_VAR,
dllName, dNameLength);
if (envret && isValidAbsolutePath(dllName))
if (envret && isValidAbsolutePath(dllName, dNameLength))
{
/* Try to load the dll from the PATH... */
m_libHandle = LoadLibraryExA(dllName,
Expand Down

0 comments on commit 5a7ecd6

Please sign in to comment.