1
1

Bump up to 1.0rc6 from the vendor branch.

This commit was SVN r23117.
Этот коммит содержится в:
Jeff Squyres 2010-05-12 17:04:48 +00:00
родитель 614a5cb4cc
Коммит bf7954c1de
27 изменённых файлов: 408 добавлений и 139 удалений

Просмотреть файл

@ -23,6 +23,7 @@ Version 1.0.0
+ Add x86 cpuid based backend.
+ Add Linux cgroup support to the Linux cpuset code.
+ Support binding of entire multithreaded process on Linux.
+ Fix and enable Group support in Windows.
+ Cleanup XML export/import.
* Objects
+ HWLOC_OBJ_PROC is renamed into HWLOC_OBJ_PU for "Processing Unit",

Просмотреть файл

@ -308,7 +308,7 @@ int main(void)
levels++;
size += obj->attr->cache.size;
}
printf("*** Logical processor 0 has %u caches totaling %luKB\n",
printf("*** Logical processor 0 has %d caches totaling %luKB\n",
levels, size / 1024);
/*****************************************************************
@ -398,6 +398,16 @@ Questions should be sent to the devel mailing list (http://www.open-mpi.org/
community/lists/hwloc.php). Bug reports should be reported in the tracker (
https://svn.open-mpi.org/trac/hwloc/).
If hwloc discovers an incorrect topology for your machine, the very first thing
you should check is to ensure that you have the most recent updates installed
for your operating system. Indeed, most of hwloc topology discovery relies on
hardware information retrieved through the operation system (e.g., via the /sys
virtual filesystem of the Linux kernel). If upgrading your OS or Linux kernel
does not solve your problem, you may also want to ensure that you are running
the most recent version of the BIOS for your machine.
If those things fail, contact us on the mailing list for additional help.
History / credits
hwloc is the evolution and merger of the libtopology (http://

Просмотреть файл

@ -16,7 +16,7 @@ release=0
# requirement is that it must be entirely printable ASCII characters
# and have no white space.
greek=rc3
greek=rc6
# If want_svn=1, then the SVN r number will be included in the overall
# hwloc version number in some form.
@ -33,11 +33,11 @@ want_svn=0
# distribution tarball is being made from an SVN checkout, the value
# of svn_r in this file is replaced with the output of "svnversion".
svn_r=r2013
svn_r=r2092
# The date when this release was created
date="Apr 29, 2010"
date="May 12, 2010"
# The shared library version of hwloc's public library. This version
# is maintained in accordance with the "Library Interface Versions"

Просмотреть файл

@ -224,7 +224,15 @@ EOF])
hwloc_CC_save=$CC
hwloc_CFLAGS_save=$CFLAGS
AC_PROG_CC_C99
hwloc_CC_c99_flags=`echo $CC | sed -e s/^$hwloc_CC_save//`
AS_IF([test x"$ac_cv_prog_cc_c99" = xno],
[AC_WARN([C99 support is required by hwloc])
$3],
[HWLOC_SETUP_CORE_AFTER_C99($1, $2, $3, $4)])
])
dnl Same order of parameters form HWLOC-SETUP-CORE
AC_DEFUN([HWLOC_SETUP_CORE_AFTER_C99],[
hwloc_CC_c99_flags=`echo $CC | sed -e "s/^$hwloc_CC_save//"`
CC=$hwloc_CC_save
CFLAGS=$hwloc_CFLAGS_save
@ -546,7 +554,6 @@ EOF])
)
# Cleanup
unset hwloc_config_happy
AC_LANG_POP
# Success

60
opal/mca/paffinity/hwloc/hwloc/configure поставляемый
Просмотреть файл

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.65 for hwloc 1.0rc3.
# Generated by GNU Autoconf 2.65 for hwloc 1.0rc6.
#
# Report bugs to <http://www.open-mpi.org/community/help/>.
#
@ -701,8 +701,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='hwloc'
PACKAGE_TARNAME='hwloc'
PACKAGE_VERSION='1.0rc3'
PACKAGE_STRING='hwloc 1.0rc3'
PACKAGE_VERSION='1.0rc6'
PACKAGE_STRING='hwloc 1.0rc6'
PACKAGE_BUGREPORT='http://www.open-mpi.org/community/help/'
PACKAGE_URL=''
@ -1541,7 +1541,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures hwloc 1.0rc3 to adapt to many kinds of systems.
\`configure' configures hwloc 1.0rc6 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1616,7 +1616,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of hwloc 1.0rc3:";;
short | recursive ) echo "Configuration of hwloc 1.0rc6:";;
esac
cat <<\_ACEOF
@ -1770,7 +1770,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
hwloc configure 1.0rc3
hwloc configure 1.0rc6
generated by GNU Autoconf 2.65
Copyright (C) 2009 Free Software Foundation, Inc.
@ -2412,7 +2412,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by hwloc $as_me 1.0rc3, which was
It was created by hwloc $as_me 1.0rc6, which was
generated by GNU Autoconf 2.65. Invocation command line was
$ $0 $@
@ -3346,7 +3346,7 @@ fi
# Define the identity of the package.
PACKAGE='hwloc'
VERSION='1.0rc3'
VERSION='1.0rc6'
cat >>confdefs.h <<_ACEOF
@ -5764,7 +5764,13 @@ if test "x$ac_cv_prog_cc_c99" != xno; then :
fi
hwloc_CC_c99_flags=`echo $CC | sed -e s/^$hwloc_CC_save//`
if test x"$ac_cv_prog_cc_c99" = xno; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: C99 support is required by hwloc" >&5
$as_echo "$as_me: WARNING: C99 support is required by hwloc" >&2;}
as_fn_error "Cannot continue" "$LINENO" 5
else
hwloc_CC_c99_flags=`echo $CC | sed -e "s/^$hwloc_CC_save//"`
CC=$hwloc_CC_save
CFLAGS=$hwloc_CFLAGS_save
@ -9967,7 +9973,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
# Cleanup
unset hwloc_config_happy
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@ -9978,10 +9983,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# Success
if test "$hwloc_setup" = "unhappy"; then :
as_fn_error "Cannot continue" "$LINENO" 5
fi
# Setup hwloc's docs, utils, and tests
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5
$as_echo_n "checking for X... " >&6; }
@ -12523,13 +12527,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
(eval echo "\"\$as_me:12526: $ac_compile\"" >&5)
(eval echo "\"\$as_me:12530: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
(eval echo "\"\$as_me:12529: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval echo "\"\$as_me:12533: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
(eval echo "\"\$as_me:12532: output\"" >&5)
(eval echo "\"\$as_me:12536: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@ -13731,7 +13735,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 13734 "configure"' > conftest.$ac_ext
echo '#line 13738 "configure"' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
@ -15231,11 +15235,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15234: $lt_compile\"" >&5)
(eval echo "\"\$as_me:15238: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:15238: \$? = $ac_status" >&5
echo "$as_me:15242: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -15570,11 +15574,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15573: $lt_compile\"" >&5)
(eval echo "\"\$as_me:15577: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:15577: \$? = $ac_status" >&5
echo "$as_me:15581: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@ -15675,11 +15679,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15678: $lt_compile\"" >&5)
(eval echo "\"\$as_me:15682: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:15682: \$? = $ac_status" >&5
echo "$as_me:15686: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -15730,11 +15734,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:15733: $lt_compile\"" >&5)
(eval echo "\"\$as_me:15737: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:15737: \$? = $ac_status" >&5
echo "$as_me:15741: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -18097,7 +18101,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 18100 "configure"
#line 18104 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -18193,7 +18197,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 18196 "configure"
#line 18200 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -19056,7 +19060,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by hwloc $as_me 1.0rc3, which was
This file was extended by hwloc $as_me 1.0rc6, which was
generated by GNU Autoconf 2.65. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -19126,7 +19130,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
hwloc config.status 1.0rc3
hwloc config.status 1.0rc6
configured by $0, generated by GNU Autoconf 2.65,
with options \\"\$ac_cs_config\\"

Просмотреть файл

@ -124,9 +124,7 @@ AS_IF([test "$enable_embedded_mode" != "yes"],
[HWLOC_BUILD_STANDALONE])])
# Setup the hwloc core
HWLOC_SETUP_CORE([], [], [hwloc_setup=unhappy], [1])
AS_IF([test "$hwloc_setup" = "unhappy"],
[AC_MSG_ERROR([Cannot continue])])
HWLOC_SETUP_CORE([], [], [AC_MSG_ERROR([Cannot continue])], [1])
# Setup hwloc's docs, utils, and tests
AS_IF([test "$hwloc_mode" = "standalone"],

Просмотреть файл

@ -408,7 +408,9 @@ endif
if HWLOC_BUILD_DOXYGEN
$(man3_MANS): $(DOX_TAG)
$(DOX_A4PDF): $(DOX_TAG)
# Enforce some ordering so that "make -j X" works properly (i.e.,
# doesn't try to build both PDFs at the same time)
$(DOX_A4PDF): $(DOX_TAG) $(DOX_LETTERPDF)
$(DOX_LETTERPDF): $(DOX_TAG)
$(DOX_HTML_DIR): $(DOX_TAG)
$(DOX_LATEX_DIR): $(DOX_TAG)

Просмотреть файл

@ -1148,7 +1148,9 @@ uninstall-man: uninstall-man3
#
@HWLOC_BUILD_DOXYGEN_TRUE@$(man3_MANS): $(DOX_TAG)
@HWLOC_BUILD_DOXYGEN_TRUE@$(DOX_A4PDF): $(DOX_TAG)
# Enforce some ordering so that "make -j X" works properly (i.e.,
# doesn't try to build both PDFs at the same time)
@HWLOC_BUILD_DOXYGEN_TRUE@$(DOX_A4PDF): $(DOX_TAG) $(DOX_LETTERPDF)
@HWLOC_BUILD_DOXYGEN_TRUE@$(DOX_LETTERPDF): $(DOX_TAG)
@HWLOC_BUILD_DOXYGEN_TRUE@$(DOX_HTML_DIR): $(DOX_TAG)
@HWLOC_BUILD_DOXYGEN_TRUE@$(DOX_LATEX_DIR): $(DOX_TAG)

Просмотреть файл

@ -99,7 +99,7 @@ int main(void)
levels++;
size += obj->attr->cache.size;
}
printf("*** Logical processor 0 has %u caches totaling %luKB\n",
printf("*** Logical processor 0 has %d caches totaling %luKB\n",
levels, size / 1024);
/*****************************************************************

Просмотреть файл

@ -317,6 +317,18 @@ list (http://www.open-mpi.org/community/lists/hwloc.php).
Bug reports should be reported in the tracker
(https://svn.open-mpi.org/trac/hwloc/).
If hwloc discovers an incorrect topology for your machine, the very
first thing you should check is to ensure that you have the most
recent updates installed for your operating system. Indeed, most of
hwloc topology discovery relies on hardware information retrieved
through the operation system (e.g., via the /sys virtual filesystem of
the Linux kernel). If upgrading your OS or Linux kernel does not
solve your problem, you may also want to ensure that you are running
the most recent version of the BIOS for your machine.
If those things fail, contact us on the mailing list for additional
help.
\htmlonly
</div><div class="section" id="credits">
\endhtmlonly

Просмотреть файл

@ -691,7 +691,8 @@ HWLOC_DECLSPEC hwloc_obj_type_t hwloc_obj_type_of_string (const char * string) _
* It differs from hwloc_obj_type_string() because it prints type attributes such
* as cache depth.
*
* \return how many characters were actually written (not including the ending \\0).
* \return how many characters were actually written (not including the ending
* \\0), or -1 on error.
*/
HWLOC_DECLSPEC int hwloc_obj_type_snprintf(char * __hwloc_restrict string, size_t size, hwloc_obj_t obj,
int verbose);
@ -702,7 +703,8 @@ HWLOC_DECLSPEC int hwloc_obj_type_snprintf(char * __hwloc_restrict string, size_
*
* Only the major attributes are printed in non-verbose mode.
*
* \return how many characters were actually written (not including the ending \\0).
* \return how many characters were actually written (not including the ending
* \\0), or -1 on error.
*/
HWLOC_DECLSPEC int hwloc_obj_attr_snprintf(char * __hwloc_restrict string, size_t size, hwloc_obj_t obj, const char * __hwloc_restrict separator,
int verbose);
@ -722,7 +724,8 @@ HWLOC_DECLSPEC int hwloc_obj_attr_snprintf(char * __hwloc_restrict string, size_
* \p indexprefix is used to prefix the \p os_index attribute number of
* the object in the description. If \c NULL, the \c # character is used.
*
* \return how many characters were actually written (not including the ending \\0).
* \return how many characters were actually written (not including the ending
* \\0), or -1 on error.
*/
HWLOC_DECLSPEC int hwloc_obj_snprintf(char * __hwloc_restrict string, size_t size,
hwloc_topology_t topology, hwloc_obj_t obj,

Просмотреть файл

@ -31,14 +31,14 @@ static inline int hwloc_have_cpuid(void)
"pushfl \n\t" \
"pop %1 \n\t" \
"cmp %1,%2\n\t" /* Compare with expected value */ \
"jnz L1 \n\t" /* Unexpected, failure */ \
"jnz Lhwloc1\n\t" /* Unexpected, failure */ \
TRY_TOGGLE /* Try to set/clear */
TRY_TOGGLE /* Try to clear/set */
"mov $1,%0\n\t" /* Passed the test! */
"L1: \n\t"
"Lhwloc1: \n\t"
"popfl \n\t" /* Restore flags */
: "=r" (ret), "=&r" (tmp), "=&r" (tmp2));

Просмотреть файл

@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
* Copyright © 2009 Cisco Systems, Inc. All rights reserved.
* Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
*/
@ -39,6 +39,8 @@ int hwloc_snprintf(char *str, size_t size, const char *format, ...)
do {
size *= 2;
str = malloc(size);
if (NULL == str)
return -1;
va_start(ap, format);
errno = 0;
ret = vsnprintf(str, size, format, ap);

Просмотреть файл

@ -319,13 +319,24 @@ hwloc_linux_get_proc_tids(DIR *taskdir, unsigned *nr_tidsp, pid_t ** tidsp)
max_tids = sb.st_nlink;
tids = malloc(max_tids*sizeof(pid_t));
if (!tids) {
errno = ENOMEM;
return -1;
}
rewinddir(taskdir);
while ((dirent = readdir(taskdir)) != NULL) {
if (nr_tids == max_tids) {
pid_t *newtids;
max_tids += 8;
tids = realloc(tids, max_tids*sizeof(pid_t));
newtids = realloc(tids, max_tids*sizeof(pid_t));
if (!newtids) {
free(tids);
errno = ENOMEM;
return -1;
}
tids = newtids;
}
if (!strcmp(dirent->d_name, ".") || !strcmp(dirent->d_name, ".."))
continue;
@ -495,7 +506,7 @@ static int
hwloc_linux_set_thisthread_cpubind(hwloc_topology_t topology, hwloc_const_cpuset_t hwloc_set, int policy __hwloc_attribute_unused)
{
if (topology->pid) {
errno = -ENOSYS;
errno = ENOSYS;
return -1;
}
return hwloc_linux_set_tid_cpubind(topology, 0, hwloc_set);
@ -505,7 +516,7 @@ static int
hwloc_linux_get_thisthread_cpubind(hwloc_topology_t topology, hwloc_cpuset_t hwloc_set, int policy __hwloc_attribute_unused)
{
if (topology->pid) {
errno = -ENOSYS;
errno = ENOSYS;
return -1;
}
return hwloc_linux_get_tid_cpubind(topology, 0, hwloc_set);
@ -520,7 +531,7 @@ hwloc_linux_set_thread_cpubind(hwloc_topology_t topology, pthread_t tid, hwloc_c
int err;
if (topology->pid) {
errno = -ENOSYS;
errno = ENOSYS;
return -1;
}
@ -587,7 +598,7 @@ hwloc_linux_get_thread_cpubind(hwloc_topology_t topology, pthread_t tid, hwloc_c
int err;
if (topology->pid) {
errno = -ENOSYS;
errno = ENOSYS;
return -1;
}

Просмотреть файл

@ -26,6 +26,7 @@ hwloc_backend_synthetic_init(struct hwloc_topology *topology, const char *descri
int cache_depth = 0, group_depth = 0;
int nb_machine_levels = 0, nb_node_levels = 0;
int nb_pu_levels = 0;
int nb_pu = 1;
assert(topology->backend_type == HWLOC_BACKEND_NONE);
@ -81,6 +82,12 @@ hwloc_backend_synthetic_init(struct hwloc_topology *topology, const char *descri
return -1;
}
nb_pu *= item;
if (nb_pu > HWLOC_NBMAXCPUS) {
fprintf(stderr, "To many PUs, max %d\n", HWLOC_NBMAXCPUS);
return -1;
}
topology->backend_params.synthetic.arity[count-1] = (unsigned)item;
topology->backend_params.synthetic.type[count] = type;
topology->backend_params.synthetic.id[count] = 0;

Просмотреть файл

@ -47,7 +47,7 @@ typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP {
RelationCache,
RelationProcessorPackage,
RelationGroup,
RelationAll = 0xffff,
RelationAll = 0xffff
} LOGICAL_PROCESSOR_RELATIONSHIP;
#endif
@ -82,15 +82,16 @@ typedef struct _GROUP_AFFINITY {
#ifndef HAVE_PROCESSOR_RELATIONSHIP
typedef struct _PROCESSOR_RELATIONSHIP {
BYTE Flags;
ULONGLONG Reserved[2];
GROUP_AFFINITY GroupMask;
BYTE Reserved[21];
WORD GroupCount;
GROUP_AFFINITY GroupMask[ANYSIZE_ARRAY];
} PROCESSOR_RELATIONSHIP, *PPROCESSOR_RELATIONSHIP;
#endif
#ifndef HAVE_NUMA_NODE_RELATIONSHIP
typedef struct _NUMA_NODE_RELATIONSHIP {
DWORD NodeNumber;
ULONGLONG Reserved[2];
BYTE Reserved[20];
GROUP_AFFINITY GroupMask;
} NUMA_NODE_RELATIONSHIP, *PNUMA_NODE_RELATIONSHIP;
#endif
@ -102,7 +103,7 @@ typedef struct _CACHE_RELATIONSHIP {
WORD LineSize;
DWORD CacheSize;
PROCESSOR_CACHE_TYPE Type;
ULONGLONG Reserved[2];
BYTE Reserved[20];
GROUP_AFFINITY GroupMask;
} CACHE_RELATIONSHIP, *PCACHE_RELATIONSHIP;
#endif
@ -111,8 +112,8 @@ typedef struct _CACHE_RELATIONSHIP {
typedef struct _PROCESSOR_GROUP_INFO {
BYTE MaximumProcessorCount;
BYTE ActiveProcessorCount;
BYTE Reserved[38];
KAFFINITY ActiveProcessorMask;
ULONGLONG Reserved[4];
} PROCESSOR_GROUP_INFO, *PPROCESSOR_GROUP_INFO;
#endif
@ -199,6 +200,8 @@ hwloc_look_windows(struct hwloc_topology *topology)
BOOL WINAPI (*GetLogicalProcessorInformationProc)(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer, PDWORD ReturnLength);
BOOL WINAPI (*GetLogicalProcessorInformationExProc)(LOGICAL_PROCESSOR_RELATIONSHIP relationship, PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Buffer, PDWORD ReturnLength);
BOOL WINAPI (*GetNumaAvailableMemoryNodeProc)(UCHAR Node, PULONGLONG AvailableBytes);
BOOL WINAPI (*GetNumaAvailableMemoryNodeExProc)(USHORT Node, PULONGLONG AvailableBytes);
DWORD length;
HMODULE kernel32;
@ -207,8 +210,10 @@ hwloc_look_windows(struct hwloc_topology *topology)
if (kernel32) {
GetLogicalProcessorInformationProc = GetProcAddress(kernel32, "GetLogicalProcessorInformation");
GetNumaAvailableMemoryNodeProc = GetProcAddress(kernel32, "GetNumaAvailableMemoryNode");
GetNumaAvailableMemoryNodeExProc = GetProcAddress(kernel32, "GetNumaAvailableMemoryNodeEx");
GetLogicalProcessorInformationExProc = GetProcAddress(kernel32, "GetLogicalProcessorInformationEx");
if (GetLogicalProcessorInformationProc) {
if (!GetLogicalProcessorInformationExProc && GetLogicalProcessorInformationProc) {
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION procInfo;
unsigned id;
unsigned i;
@ -223,8 +228,7 @@ hwloc_look_windows(struct hwloc_topology *topology)
break;
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
return;
free(procInfo);
procInfo = malloc(length);
procInfo = realloc(procInfo, length);
}
for (i = 0; i < length / sizeof(*procInfo); i++) {
@ -267,7 +271,8 @@ hwloc_look_windows(struct hwloc_topology *topology)
ULONGLONG avail;
obj->nodeset = hwloc_cpuset_alloc();
hwloc_cpuset_set(obj->nodeset, id);
if (GetNumaAvailableMemoryNodeProc && GetNumaAvailableMemoryNodeProc(id, &avail))
if ((GetNumaAvailableMemoryNodeExProc && GetNumaAvailableMemoryNodeExProc(id, &avail))
|| (GetNumaAvailableMemoryNodeProc && GetNumaAvailableMemoryNodeProc(id, &avail)))
obj->memory.local_memory = avail;
obj->memory.page_types_len = 1;
obj->memory.page_types = malloc(sizeof(*obj->memory.page_types));
@ -293,19 +298,12 @@ hwloc_look_windows(struct hwloc_topology *topology)
free(procInfo);
}
GetLogicalProcessorInformationExProc = GetProcAddress(kernel32, "GetLogicalProcessorInformationEx");
/* Disabled for now as it wasn't tested at all. */
if (0 && GetLogicalProcessorInformationExProc) {
if (GetLogicalProcessorInformationExProc) {
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX procInfoTotal, procInfo;
signed id;
unsigned id;
struct hwloc_obj *obj;
hwloc_obj_type_t type;
KAFFINITY mask;
WORD group;
fprintf(stderr,"Note: GetLogicalProcessorInformationEx was never tested yet!\n");
length = 0;
procInfoTotal = NULL;
@ -315,13 +313,14 @@ hwloc_look_windows(struct hwloc_topology *topology)
break;
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
return;
free(procInfoTotal);
procInfo = malloc(length);
procInfoTotal = realloc(procInfoTotal, length);
}
for (procInfo = procInfoTotal;
(void*) procInfo < (void*) ((unsigned long) procInfoTotal + length);
procInfo = (void*) ((unsigned long) procInfo + procInfo->Size)) {
unsigned num, i;
GROUP_AFFINITY *GroupMask;
/* Ignore non-data caches */
if (procInfo->Relationship == RelationCache &&
@ -333,32 +332,34 @@ hwloc_look_windows(struct hwloc_topology *topology)
switch (procInfo->Relationship) {
case RelationNumaNode:
type = HWLOC_OBJ_NODE;
mask = procInfo->NumaNode.GroupMask.Mask;
group = procInfo->NumaNode.GroupMask.Group;
num = 1;
GroupMask = &procInfo->NumaNode.GroupMask;
id = procInfo->NumaNode.NodeNumber;
break;
case RelationProcessorPackage:
type = HWLOC_OBJ_SOCKET;
mask = procInfo->Processor.GroupMask.Mask;
group = procInfo->Processor.GroupMask.Group;
num = procInfo->Processor.GroupCount;
GroupMask = procInfo->Processor.GroupMask;
break;
case RelationCache:
type = HWLOC_OBJ_CACHE;
mask = procInfo->Cache.GroupMask.Mask;
group = procInfo->Cache.GroupMask.Group;
num = 1;
GroupMask = &procInfo->Cache.GroupMask;
break;
case RelationProcessorCore:
type = HWLOC_OBJ_CORE;
mask = procInfo->Processor.GroupMask.Mask;
group = procInfo->Processor.GroupMask.Group;
num = procInfo->Processor.GroupCount;
GroupMask = procInfo->Processor.GroupMask;
break;
case RelationGroup:
/* So strange an interface... */
for (id = 0; id < procInfo->Group.ActiveGroupCount; id++) {
KAFFINITY mask;
obj = hwloc_alloc_setup_object(HWLOC_OBJ_GROUP, id);
obj->cpuset = hwloc_cpuset_alloc();
mask = procInfo->Group.GroupInfo[id].ActiveProcessorMask;
hwloc_debug("group %d mask %lx\n", id, mask);
hwloc_debug("group %u %d cpus mask %lx\n", id,
procInfo->Group.GroupInfo[id].ActiveProcessorCount, mask);
hwloc_cpuset_from_ith_ulong(obj->cpuset, id, mask);
hwloc_insert_object_by_cpuset(topology, obj);
}
@ -370,21 +371,28 @@ hwloc_look_windows(struct hwloc_topology *topology)
obj = hwloc_alloc_setup_object(type, id);
obj->cpuset = hwloc_cpuset_alloc();
hwloc_debug("%s#%d mask %d:%lx\n", hwloc_obj_type_string(type), id, group, mask);
hwloc_cpuset_from_ith_ulong(obj->cpuset, group, mask);
for (i = 0; i < num; i++) {
hwloc_debug("%s#%u %d: mask %d:%lx\n", hwloc_obj_type_string(type), id, i, GroupMask[i].Group, GroupMask[i].Mask);
hwloc_cpuset_from_ith_ulong(obj->cpuset, GroupMask[i].Group, GroupMask[i].Mask);
}
switch (type) {
case HWLOC_OBJ_NODE:
obj->nodeset = hwloc_cpuset_alloc();
hwloc_cpuset_set(obj->nodeset, id);
obj->memory.local_memory = 0; /* TODO GetNumaAvailableMemoryNodeEx */
obj->memory.page_types_len = 1;
obj->memory.page_types = malloc(sizeof(*obj->memory.page_types));
memset(obj->memory.page_types, 0, sizeof(*obj->memory.page_types));
{
ULONGLONG avail;
obj->nodeset = hwloc_cpuset_alloc();
hwloc_cpuset_set(obj->nodeset, id);
if ((GetNumaAvailableMemoryNodeExProc && GetNumaAvailableMemoryNodeExProc(id, &avail))
|| (GetNumaAvailableMemoryNodeProc && GetNumaAvailableMemoryNodeProc(id, &avail)))
obj->memory.local_memory = avail;
obj->memory.page_types_len = 1;
obj->memory.page_types = malloc(sizeof(*obj->memory.page_types));
memset(obj->memory.page_types, 0, sizeof(*obj->memory.page_types));
#ifdef HAVE__SC_LARGE_PAGESIZE
obj->memory.page_types[0].size = sysconf(_SC_LARGE_PAGESIZE);
obj->memory.page_types[0].size = sysconf(_SC_LARGE_PAGESIZE);
#endif
break;
break;
}
case HWLOC_OBJ_CACHE:
obj->attr->cache.size = procInfo->Cache.CacheSize;
obj->attr->cache.depth = procInfo->Cache.Level;

Просмотреть файл

@ -41,6 +41,9 @@
#include <windows.h>
#endif
static void
hwloc_topology_clear (struct hwloc_topology *topology);
#if defined(HAVE_SYSCTLBYNAME)
int hwloc_get_sysctlbyname(const char *name, int *ret)
{
@ -698,13 +701,14 @@ hwloc__insert_object_by_cpuset(struct hwloc_topology *topology, hwloc_obj_t cur,
/* if both objects have a page_types array, just keep the biggest one for now */
if (obj->memory.page_types_len && child->memory.page_types_len)
hwloc_debug("%s", "merging page_types by keeping the biggest one only\n");
if (obj->memory.page_types_len > child->memory.page_types_len) {
free(child->memory.page_types);
} else {
if (obj->memory.page_types_len < child->memory.page_types_len) {
free(obj->memory.page_types);
obj->memory.page_types_len = child->memory.page_types_len;
obj->memory.page_types = child->memory.page_types;
child->memory.page_types = NULL;
} else {
free(child->memory.page_types);
child->memory.page_types_len = obj->memory.page_types_len;
child->memory.page_types = obj->memory.page_types;
obj->memory.page_types = NULL;
obj->memory.page_types_len = 0;
}
break;
case HWLOC_OBJ_CACHE:
@ -1376,7 +1380,7 @@ static void alloc_cpusets(hwloc_obj_t obj)
}
/* Main discovery loop */
static void
static int
hwloc_discover(struct hwloc_topology *topology)
{
unsigned l, i=0, taken_i, new_i, j;
@ -1514,7 +1518,7 @@ hwloc_discover(struct hwloc_topology *topology)
print_objects(topology, 0, topology->levels[0][0]);
if (!topology->flags & HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM) {
if (!(topology->flags & HWLOC_TOPOLOGY_FLAG_WHOLE_SYSTEM)) {
hwloc_debug("%s", "\nRemoving unauthorized and offline cpusets from all cpusets\n");
remove_unused_cpusets(topology->levels[0][0]);
@ -1558,6 +1562,11 @@ hwloc_discover(struct hwloc_topology *topology)
l = 0;
n_objs = topology->levels[0][0]->arity;
objs = malloc(n_objs * sizeof(objs[0]));
if (!objs) {
errno = ENOMEM;
hwloc_topology_clear(topology);
return -1;
}
memcpy(objs, topology->levels[0][0]->children, n_objs * sizeof(objs[0]));
/* Keep building levels while there are objects left in OBJS. */
@ -1722,6 +1731,8 @@ hwloc_discover(struct hwloc_topology *topology)
DO(set_thread_cpubind);
DO(get_thread_cpubind);
}
return 0;
}
/* To be before discovery is actually launched,
@ -1958,6 +1969,7 @@ int
hwloc_topology_load (struct hwloc_topology *topology)
{
char *local_env;
int err;
if (topology->is_loaded) {
hwloc_topology_clear(topology);
@ -2015,7 +2027,9 @@ hwloc_topology_load (struct hwloc_topology *topology)
}
/* actual topology discovery */
hwloc_discover(topology);
err = hwloc_discover(topology);
if (err < 0)
return err;
/* enforce THISSYSTEM if given in a FORCE variable */
local_env = getenv("HWLOC_FORCE_THISSYSTEM");

Просмотреть файл

@ -265,7 +265,7 @@ hwloc_obj_snprintf(char *string, size_t size,
hwloc_obj_type_snprintf(type, sizeof(type), l, verbose);
attrlen = hwloc_obj_attr_snprintf(attr, sizeof(attr), l, " ", verbose);
if (attrlen)
if (attrlen > 0)
return hwloc_snprintf(string, size, "%s%s(%s)", type, os_index, attr);
else
return hwloc_snprintf(string, size, "%s%s", type, os_index);

Просмотреть файл

@ -39,8 +39,10 @@ endif HWLOC_BUILD_TESTS
# Only install man pages if we're building in standalone mode
if HWLOC_BUILD_UTILS
man_pages = hwloc.7 lstopo.1 hwloc-bind.1 hwloc-distrib.1 hwloc-calc.1
EXTRA_DIST += $(man_pages:.1=.1in)
man1_pages = lstopo.1 hwloc-bind.1 hwloc-distrib.1 hwloc-calc.1
man7_pages = hwloc.7
man_pages = $(man7_pages) $(man1_pages)
EXTRA_DIST += $(man1_pages:.1=.1in) $(man7_pages:.7=.7in)
nodist_man_MANS = $(man_pages)
.1in.1:

Просмотреть файл

@ -45,7 +45,7 @@ target_triplet = @target@
@HWLOC_HAVE_CAIRO_TRUE@am__append_1 = lstopo-cairo.c
@HWLOC_HAVE_XML_TRUE@am__append_2 = lstopo-xml.c
@HWLOC_HAVE_WINDOWS_TRUE@am__append_3 = lstopo-windows.c
@HWLOC_BUILD_UTILS_TRUE@am__append_4 = $(man_pages:.1=.1in)
@HWLOC_BUILD_UTILS_TRUE@am__append_4 = $(man1_pages:.1=.1in) $(man7_pages:.7=.7in)
subdir = utils
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/test-hwloc-distrib.sh.in
@ -334,7 +334,9 @@ hwloc_calc_SOURCES = hwloc-calc.c hwloc-calc.h
@HWLOC_BUILD_TESTS_TRUE@@HWLOC_HAVE_MINGW32_FALSE@TESTS = test-hwloc-distrib.sh
# Only install man pages if we're building in standalone mode
@HWLOC_BUILD_UTILS_TRUE@man_pages = hwloc.7 lstopo.1 hwloc-bind.1 hwloc-distrib.1 hwloc-calc.1
@HWLOC_BUILD_UTILS_TRUE@man1_pages = lstopo.1 hwloc-bind.1 hwloc-distrib.1 hwloc-calc.1
@HWLOC_BUILD_UTILS_TRUE@man7_pages = hwloc.7
@HWLOC_BUILD_UTILS_TRUE@man_pages = $(man7_pages) $(man1_pages)
@HWLOC_BUILD_UTILS_TRUE@nodist_man_MANS = $(man_pages)
all: all-am

Просмотреть файл

@ -1,6 +1,6 @@
.\" -*- nroff -*-
.\" Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
.TH HWLOC "1" "Apr 16, 2010" "1.0rc1" "hwloc"
.TH HWLOC "1" "#HWLOC_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#"
.SH NAME
hwloc - General information about hwloc ("hardware locality").
.

Просмотреть файл

@ -32,12 +32,14 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <X11/cursorfont.h>
#endif /* CAIRO_HAS_XLIB_SURFACE */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
#include "lstopo.h"
@ -109,6 +111,7 @@ struct display {
Display *dpy;
cairo_surface_t *cs;
Window win;
Cursor hand;
int screen_width, screen_height; /** visible part size */
int width, height; /** total size */
int x, y; /** top left corner of the visible part */
@ -124,6 +127,7 @@ x11_start(void *output __hwloc_attribute_unused, int width, int height)
Screen *screen;
int screen_width = width, screen_height = height;
struct display *disp;
Cursor hand;
if (!(dpy = XOpenDisplay(NULL))) {
fprintf(stderr, "couldn't connect to X\n");
@ -138,6 +142,8 @@ x11_start(void *output __hwloc_attribute_unused, int width, int height)
root = RootWindow(dpy, scr);
top = XCreateSimpleWindow(dpy, root, 0, 0, screen_width, screen_height, 0, WhitePixel(dpy, scr), WhitePixel(dpy, scr));
win = XCreateSimpleWindow(dpy, top, 0, 0, width, height, 0, WhitePixel(dpy, scr), WhitePixel(dpy, scr));
hand = XCreateFontCursor(dpy, XC_fleur);
XDefineCursor(dpy, win, hand);
XSelectInput(dpy, win,
KeyPressMask |
@ -154,6 +160,7 @@ x11_start(void *output __hwloc_attribute_unused, int width, int height)
disp->dpy = dpy;
disp->cs = cs;
disp->win = win;
disp->hand = hand;
disp->screen_width = screen_width;
disp->screen_height = screen_height;
disp->width = width;
@ -255,13 +262,63 @@ output_x11(hwloc_topology_t topology, const char *filename __hwloc_attribute_unu
case KeyPress: {
KeySym keysym;
XLookupString(&e.xkey, NULL, 0, &keysym, NULL);
if (keysym == XK_q || keysym == XK_Q)
finish = 1;
switch (keysym) {
case XK_q:
case XK_Q:
case XK_Escape:
finish = 1;
break;
case XK_Left:
disp->x -= disp->screen_width/10;
move_x11(disp);
break;
case XK_Right:
disp->x += disp->screen_width/10;
move_x11(disp);
break;
case XK_Up:
disp->y -= disp->screen_height/10;
move_x11(disp);
break;
case XK_Down:
disp->y += disp->screen_height/10;
move_x11(disp);
break;
case XK_Page_Up:
if (e.xkey.state & ControlMask) {
disp->x -= disp->screen_width;
move_x11(disp);
} else {
disp->y -= disp->screen_height;
move_x11(disp);
}
break;
case XK_Page_Down:
if (e.xkey.state & ControlMask) {
disp->x += disp->screen_width;
move_x11(disp);
} else {
disp->y += disp->screen_height;
move_x11(disp);
}
break;
case XK_Home:
disp->x = 0;
disp->y = 0;
move_x11(disp);
break;
case XK_End:
disp->x = INT_MAX;
disp->y = INT_MAX;
move_x11(disp);
break;
}
break;
}
}
}
cairo_surface_destroy(disp->cs);
XFreeCursor(disp->dpy, disp->hand);
XCloseDisplay(disp->dpy);
free(disp);
}

Просмотреть файл

@ -338,12 +338,12 @@ lstopo_obj_snprintf(char *text, size_t textlen, hwloc_obj_t obj, int logical)
char typestr[32];
char indexstr[32]= "";
char attrstr[256];
size_t attrlen;
int attrlen;
hwloc_obj_type_snprintf(typestr, sizeof(typestr), obj, 0);
if (idx != (unsigned)-1 && obj->depth != 0)
snprintf(indexstr, sizeof(indexstr), "%s%u", indexprefix, idx);
attrlen = hwloc_obj_attr_snprintf(attrstr, sizeof(attrstr), obj, " ", 0);
if (attrlen)
if (attrlen > 0)
return snprintf(text, textlen, "%s%s (%s)", typestr, indexstr, attrstr);
else
return snprintf(text, textlen, "%s%s", typestr, indexstr);
@ -365,7 +365,7 @@ pu_draw(hwloc_topology_t topology, struct draw_methods *methods, int logical, hw
methods->box(output, FORBIDDEN_R_COLOR, FORBIDDEN_G_COLOR, FORBIDDEN_B_COLOR, depth, x, *retwidth, y, *retheight);
else {
hwloc_cpuset_t bind = hwloc_cpuset_alloc();
if (pid > 0)
if (pid != (hwloc_pid_t) -1 && pid != 0)
hwloc_get_proc_cpubind(topology, pid, bind, 0);
else if (pid == 0)
hwloc_get_cpubind(topology, bind, 0);
@ -398,12 +398,12 @@ cache_draw(hwloc_topology_t topology, struct draw_methods *methods, int logical,
unsigned myheight = gridsize + (fontsize ? (fontsize + gridsize) : 0) + gridsize, totheight;
unsigned mywidth = 0, totwidth;
unsigned textwidth = fontsize ? ((logical ? level->logical_index : level->os_index) == (unsigned) -1 ? 7*fontsize : 9*fontsize) : 0;
/* Do not separate objects when in L1 (SMT) */
unsigned separator = level->attr->cache.depth > 1 ? gridsize : 0;
DYNA_CHECK();
/* Do not separate objects when in L1 (SMT) */
RECURSE_HORIZ(level, &null_draw_methods, separator, 0);
RECURSE_RECT(level, &null_draw_methods, separator, 0);
methods->box(output, CACHE_R_COLOR, CACHE_G_COLOR, CACHE_B_COLOR, depth, x, totwidth, y, myheight - gridsize);
@ -414,7 +414,7 @@ cache_draw(hwloc_topology_t topology, struct draw_methods *methods, int logical,
methods->text(output, 0, 0, 0, fontsize, depth-1, x + gridsize, y + gridsize, text);
}
RECURSE_HORIZ(level, methods, separator, 0);
RECURSE_RECT(level, methods, separator, 0);
DYNA_SAVE();
}
@ -428,7 +428,7 @@ core_draw(hwloc_topology_t topology, struct draw_methods *methods, int logical,
DYNA_CHECK();
RECURSE_HORIZ(level, &null_draw_methods, 0, gridsize);
RECURSE_RECT(level, &null_draw_methods, 0, gridsize);
methods->box(output, CORE_R_COLOR, CORE_G_COLOR, CORE_B_COLOR, depth, x, totwidth, y, totheight);
@ -438,7 +438,7 @@ core_draw(hwloc_topology_t topology, struct draw_methods *methods, int logical,
methods->text(output, 0, 0, 0, fontsize, depth-1, x + gridsize, y + gridsize, text);
}
RECURSE_HORIZ(level, methods, 0, gridsize);
RECURSE_RECT(level, methods, 0, gridsize);
DYNA_SAVE();
}
@ -485,7 +485,7 @@ node_draw(hwloc_topology_t topology, struct draw_methods *methods, int logical,
DYNA_CHECK();
/* Compute the size needed by sublevels */
RECURSE_HORIZ(level, &null_draw_methods, gridsize, gridsize);
RECURSE_RECT(level, &null_draw_methods, gridsize, gridsize);
/* Draw the epoxy box */
methods->box(output, NODE_R_COLOR, NODE_G_COLOR, NODE_B_COLOR, depth, x, totwidth, y, totheight);
@ -500,7 +500,7 @@ node_draw(hwloc_topology_t topology, struct draw_methods *methods, int logical,
}
/* Restart, now really drawing sublevels */
RECURSE_HORIZ(level, methods, gridsize, gridsize);
RECURSE_RECT(level, methods, gridsize, gridsize);
/* Save result for dynamic programming */
DYNA_SAVE();

Просмотреть файл

@ -341,7 +341,7 @@ set_color(int fr, int fg, int fb, int br, int bg, int bb)
/* We we can, allocate rgb colors */
static void
text_declare_color(void *output __hwloc_attribute_unused, int r, int g, int b)
text_declare_color(void *output __hwloc_attribute_unused, int r __hwloc_attribute_unused, int g __hwloc_attribute_unused, int b __hwloc_attribute_unused)
{
#ifdef HWLOC_HAVE_LIBTERMCAP
int color = declare_color(r, g, b);
@ -363,7 +363,7 @@ text_declare_color(void *output __hwloc_attribute_unused, int r, int g, int b)
/* output text, erasing any previous content */
static void
put(struct display *disp, int x, int y, character c, int fr, int fg, int fb, int br, int bg, int bb)
put(struct display *disp, int x, int y, character c, int fr __hwloc_attribute_unused, int fg __hwloc_attribute_unused, int fb __hwloc_attribute_unused, int br __hwloc_attribute_unused, int bg __hwloc_attribute_unused, int bb __hwloc_attribute_unused)
{
if (x >= disp->width || y >= disp->height) {
/* fprintf(stderr, "%"PRIchar" overflowed to (%d,%d)\n", c, x, y); */
@ -389,7 +389,7 @@ enum {
up = (1<<0),
down = (1<<1),
left = (1<<2),
right = (1<<3),
right = (1<<3)
};
/* Convert a bar character into its directions */
@ -605,8 +605,8 @@ void output_text(hwloc_topology_t topology, const char *filename, int logical, i
int lbr, lbg, lbb; /* Last background color */
#ifdef HWLOC_HAVE_LIBTERMCAP
int term = 0;
#endif
char *tmp;
#endif
if (!filename || !strcmp(filename, "-"))
output = stdout;

Просмотреть файл

@ -11,6 +11,7 @@
#include <string.h>
#include <windows.h>
#include <windowsx.h>
#include "lstopo.h"
@ -40,10 +41,16 @@ struct draw_methods windows_draw_methods;
static hwloc_topology_t the_topology;
static int the_logical;
static int state, control;
static int x, y, x_delta, y_delta;
static int finish;
static int the_width, the_height;
static int win_width, win_height;
static LRESULT CALLBACK
WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
int redraw = 0;
switch (message) {
case WM_PAINT: {
HDC hdc;
@ -53,31 +60,141 @@ WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
EndPaint(hwnd, &ps);
break;
}
case WM_LBUTTONDOWN:
state = 1;
x = GET_X_LPARAM(lparam);
y = GET_Y_LPARAM(lparam);
break;
case WM_LBUTTONUP:
state = 0;
break;
case WM_MOUSEMOVE:
if (!(wparam & MK_LBUTTON))
state = 0;
if (state) {
int new_x = GET_X_LPARAM(lparam);
int new_y = GET_Y_LPARAM(lparam);
x_delta -= new_x - x;
y_delta -= new_y - y;
x = new_x;
y = new_y;
redraw = 1;
}
break;
case WM_KEYDOWN:
switch (wparam) {
case 'q':
case 'Q':
case VK_ESCAPE:
finish = 1;
break;
case VK_LEFT:
x_delta -= win_width/10;
redraw = 1;
break;
case VK_RIGHT:
x_delta += win_width/10;
redraw = 1;
break;
case VK_UP:
y_delta -= win_height/10;
redraw = 1;
break;
case VK_DOWN:
y_delta += win_height/10;
redraw = 1;
break;
case VK_PRIOR:
if (control) {
x_delta -= win_width;
redraw = 1;
} else {
y_delta -= win_height;
redraw = 1;
}
break;
case VK_NEXT:
if (control) {
x_delta += win_width;
redraw = 1;
} else {
y_delta += win_height;
redraw = 1;
}
break;
case VK_HOME:
x_delta = 0;
y_delta = 0;
redraw = 1;
break;
case VK_END:
x_delta = INT_MAX;
y_delta = INT_MAX;
redraw = 1;
break;
case VK_CONTROL:
control = 1;
break;
}
break;
case WM_KEYUP:
switch (wparam) {
case VK_CONTROL:
control = 0;
break;
}
break;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
case WM_SIZE:
win_width = LOWORD(lparam);
win_height = HIWORD(lparam);
redraw = 1;
break;
}
if (redraw) {
if (x_delta > the_width - win_width)
x_delta = the_width - win_width;
if (y_delta > the_height - win_height)
y_delta = the_height - win_height;
if (x_delta < 0)
x_delta = 0;
if (y_delta < 0)
y_delta = 0;
RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
}
return DefWindowProc(hwnd, message, wparam, lparam);
}
static void *
windows_start(void *output_, int width, int height)
windows_start(void *output_ __hwloc_attribute_unused, int width, int height)
{
WNDCLASS wndclass = {
.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH),
.hCursor = LoadCursor(NULL, IDC_ARROW),
.hCursor = LoadCursor(NULL, IDC_SIZEALL),
.hIcon = LoadIcon(NULL, IDI_APPLICATION),
.lpfnWndProc = WndProc,
.lpszClassName = "lstopo",
};
HWND toplevel;
win_width = width + 2*GetSystemMetrics(SM_CXSIZEFRAME);
win_height = height + 2*GetSystemMetrics(SM_CYSIZEFRAME) + GetSystemMetrics(SM_CYCAPTION);
if (win_width > GetSystemMetrics(SM_CXFULLSCREEN))
win_width = GetSystemMetrics(SM_CXFULLSCREEN);
if (win_height > GetSystemMetrics(SM_CYFULLSCREEN))
win_height = GetSystemMetrics(SM_CYFULLSCREEN);
RegisterClass(&wndclass);
toplevel = CreateWindow("lstopo", "lstopo", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
width + 2*GetSystemMetrics(SM_CXSIZEFRAME),
height + 2*GetSystemMetrics(SM_CYSIZEFRAME) + GetSystemMetrics(SM_CYSMCAPTION),
NULL, NULL, NULL, NULL);
win_width, win_height, NULL, NULL, NULL, NULL);
the_width = width;
the_height = height;
ShowWindow(toplevel, SW_SHOWDEFAULT);
@ -85,7 +202,7 @@ windows_start(void *output_, int width, int height)
}
static void
windows_declare_color(void *output_, int r, int g, int b)
windows_declare_color(void *output_ __hwloc_attribute_unused, int r, int g, int b)
{
HBRUSH brush;
COLORREF color = RGB(r, g, b);
@ -105,32 +222,32 @@ windows_declare_color(void *output_, int r, int g, int b)
}
static void
windows_box(void *output, int r, int g, int b, unsigned depth, unsigned x, unsigned width, unsigned y, unsigned height)
windows_box(void *output, int r, int g, int b, unsigned depth __hwloc_attribute_unused, unsigned x, unsigned width, unsigned y, unsigned height)
{
PAINTSTRUCT *ps = output;
SelectObject(ps->hdc, rgb_to_brush(r, g, b));
SetBkColor(ps->hdc, RGB(r, g, b));
Rectangle(ps->hdc, x, y, x + width, y + height);
Rectangle(ps->hdc, x - x_delta, y - y_delta, x + width - x_delta, y + height - y_delta);
}
static void
windows_line(void *output, int r, int g, int b, unsigned depth, unsigned x1, unsigned y1, unsigned x2, unsigned y2)
windows_line(void *output, int r, int g, int b, unsigned depth __hwloc_attribute_unused, unsigned x1, unsigned y1, unsigned x2, unsigned y2)
{
PAINTSTRUCT *ps = output;
SelectObject(ps->hdc, rgb_to_brush(r, g, b));
MoveToEx(ps->hdc, x1, y1, NULL);
LineTo(ps->hdc, x2, y2);
MoveToEx(ps->hdc, x1 - x_delta, y1 - y_delta, NULL);
LineTo(ps->hdc, x2 - x_delta, y2 - y_delta);
}
static void
windows_text(void *output, int r, int g, int b, int size, unsigned depth, unsigned x, unsigned y, const char *text)
windows_text(void *output, int r, int g, int b, int size, unsigned depth __hwloc_attribute_unused, unsigned x, unsigned y, const char *text)
{
PAINTSTRUCT *ps = output;
HFONT font;
SetTextColor(ps->hdc, RGB(r, g, b));
font = CreateFont(size, 0, 0, 0, 0, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, NULL);
SelectObject(ps->hdc, (HGDIOBJ) font);
TextOut(ps->hdc, x, y, text, strlen(text));
TextOut(ps->hdc, x - x_delta, y - y_delta, text, strlen(text));
DeleteObject(font);
}
@ -143,7 +260,7 @@ struct draw_methods windows_draw_methods = {
};
void
output_windows (hwloc_topology_t topology, const char *filename, int logical, int verbose_mode)
output_windows (hwloc_topology_t topology, const char *filename __hwloc_attribute_unused, int logical, int verbose_mode __hwloc_attribute_unused)
{
HWND toplevel;
the_topology = topology;
@ -151,7 +268,7 @@ output_windows (hwloc_topology_t topology, const char *filename, int logical, in
toplevel = output_draw_start(&windows_draw_methods, logical, topology, NULL);
UpdateWindow(toplevel);
MSG msg;
while (GetMessage(&msg, NULL, 0, 0)) {
while (!finish && GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}

Просмотреть файл

@ -214,6 +214,16 @@ running lstopo in one context may show a specific CPU as red, but
running lstopo in a different context may show the same CPU as white).
.
.\" **************************
.\" Layout Section
.\" **************************
.SH LAYOUT
In its graphical output, lstopo uses simple rectangular heuristics
to try to achieve a 4/3 ratio between width and height. However,
in the particular case of NUMA nodes, the layout is always a flat
rectangle, to avoid letting the user believe any particular NUMA
topology (lstopo is not able to render that yet).
.
.\" **************************
.\" Examples Section
.\" **************************
.SH EXAMPLES

Просмотреть файл

@ -27,7 +27,7 @@ unsigned int gridsize = 10;
unsigned int force_horiz = 0;
unsigned int force_vert = 0;
unsigned int top = 0;
hwloc_pid_t pid = -1;
hwloc_pid_t pid = (hwloc_pid_t) -1;
FILE *open_file(const char *filename, const char *mode)
{
@ -341,7 +341,7 @@ main (int argc, char *argv[])
return EXIT_FAILURE;
}
}
if (pid > 0) {
if (pid != (hwloc_pid_t) -1 && pid != 0) {
if (hwloc_topology_set_pid(topology, pid)) {
perror("Setting target pid");
return EXIT_FAILURE;