summaryrefslogtreecommitdiff
path: root/utils/env_dump
diff options
context:
space:
mode:
Diffstat (limited to 'utils/env_dump')
-rw-r--r--utils/env_dump/Makefile39
-rw-r--r--utils/env_dump/README248
-rw-r--r--utils/env_dump/cpu.c197
-rw-r--r--utils/env_dump/drm.c139
-rw-r--r--utils/env_dump/env_dump.c157
-rw-r--r--utils/env_dump/env_dump.h84
-rwxr-xr-xutils/env_dump/env_dump.sh14
-rwxr-xr-xutils/env_dump/env_dump_extend.sh194
-rwxr-xr-xutils/env_dump/env_dump_parser.py229
-rw-r--r--utils/env_dump/fd.c205
-rw-r--r--utils/env_dump/gl.c302
-rw-r--r--utils/env_dump/libs.c451
-rw-r--r--utils/env_dump/linux.c49
-rw-r--r--utils/env_dump/net.c80
-rw-r--r--utils/env_dump/posix_env.c201
-rwxr-xr-xutils/env_dump/scripts/intel-gpu-search-pci-id.sh169
-rw-r--r--utils/env_dump/xorg.c205
17 files changed, 0 insertions, 2963 deletions
diff --git a/utils/env_dump/Makefile b/utils/env_dump/Makefile
deleted file mode 100644
index 2de8edd..0000000
--- a/utils/env_dump/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-CC = gcc
-CFLAGS = -c -Wall -fPIC -g
-LDFLAGS = -shared -g
-
-SHA1_DB ?= ../../SHA1_DB
-
-SOURCES = env_dump.c cpu.c drm.c fd.c gl.c libs.c linux.c net.c posix_env.c xorg.c
-OBJECTS = $(SOURCES:.c=.o)
-
-# Name of executable target:
-EXECUTABLE = env_dump.so
-
-# libcrypto
-CFLAGS += `pkg-config --cflags libcrypto`
-
-# libxrandr
-CFLAGS += `pkg-config --cflags xrandr`
-
-# libxrandr
-CFLAGS += `pkg-config --cflags libdrm`
-
-# other libs
-LDFLAGS += -lpthread -ldl
-
-all: $(SOURCES) $(EXECUTABLE)
-
-$(EXECUTABLE): $(OBJECTS)
- $(CC) $(OBJECTS) -o $@ $(LDFLAGS)
- @if [ -e "${SHA1_DB}/sha1_db" ]; then \
- ${SHA1_DB}/sha1_db ${SHA1_DB} - add_git . $(EXECUTABLE); \
- else \
- echo "Warning: SHA1_DB is not defined, cannot add the version to the SHA1_DB."; \
- fi
-
-.c.o:
- $(CC) $(CFLAGS) $< -o $@
-
-clean:
- rm $(OBJECTS) $(EXECUTABLE)
diff --git a/utils/env_dump/README b/utils/env_dump/README
deleted file mode 100644
index 2479d33..0000000
--- a/utils/env_dump/README
+++ /dev/null
@@ -1,248 +0,0 @@
-= Env dump =
-
-== Description ==
-
-This library is meant to be used in conjunction with LD_PRELOAD to dump as much
-information as possible about the machine, the run, the libraries used, etc...
-
-The output of the library is saved in a file. You can select the filename using
-the environment variable ENV_DUMP_FILE. If the file is already present, the pid
-will be appended to avoid overriding existing data. If you do not set the
-ENV_DUMP_FILE env. var., the default output file will be '/tmp/env_dump'.
-
-== Compilation ==
-
-Please install the libcrypto and then type make in the directory containing this
-README. You should get a env_dump.so.
-
-== Usage ==
-
-=== Running the application ===
-
-There are two possible ways:
-
- - $ LD_PRELOAD=$PWD/env_dump.so ENV_DUMP_FILE=report xonotic-glx # either this way
- - $ env_dump.sh report xonotic-glx # or this way, your call!
-
-=== SHA1 Database ===
-
-The SHA1 DB is meant to link the SHA1 of an executable to a release version or
-git SHA1 from an upstream branch along with how it got compiled.
-
-The DB can be accessed through a command line interface using /SHA1_DB/sha1_db.
-The tool supports adding new SHA1s, querying attributes and adding attributes.
-
-Use the function make_install_sha1_dump from /profiles.d/utils/sha1_db.sh to
-install a git version of any project supporting DESTDIR overriding. The command
-line is:
-
-$ SHA1_DB=/my/path/to/SHA1_DB make_install_sha1_dump
-
-The configuration is however not currently saved but it is being investigated.
-
-=== Adding data to the report ===
-
-If you have SHA1_DB set-up and have installed packagekit and dmidecode, it is
-possible to enhance the report by adding information about the HW and SW used
-during the run.
-
-$ env_dump_extend.sh ../../SHA1_DB/ report
-
-=== Parsing the output ===
-
-The output is a CSV file which should be easy to parse. The plan is to write a
-python parser that will evolve in sync with the format of the CSV.
-
-This work has not been started yet and will be the basis of a tool comparing
-the environment between two runs.
-
-=== Viewing the final report ===
-
-Here is an example of report for the game xonotic.
-
-$ cat report
--- Env dump start (version 1) --
-MOTHERBOARD,ASUSTeK COMPUTER INC.,Z97-A,Rev 1.xx
-BIOS,American Megatrends Inc.,1204,06/20/2014
-PROCESSOR,1,Intel,C3 06 03 00 FF FB EB BF,Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz,4,8,256 kB,1024 kB,8192 kB,3800 MHz,1
-RAM_STICK,1,DDR3,1315,BLS4G3D1609DS1S00.,A90D6072,4096 MB,1600 MHz
-RAM_STICK,2,DDR3,Kingston,KHX1600C9D3/4GX,6E2A1C4B,4096 MB,1600 MHz
-RAM_STICK,3,DDR3,1315,BLS4G3D1609DS1S00.,A90D6071,4096 MB,1600 MHz
-RAM_STICK,4,DDR3,Kingston,KHX1600C9D3/4GX,6B2A204B,4096 MB,1600 MHz
-EXE,/usr/bin/xonotic-glx,'xonotic-glx',3d1e4934b68d33f967796d662ca150829cbb6393,Arch-xonotic-0.8.1-1.x86_64
-ENV,LD_PRELOAD=/home/mupuf/benchmarks/ezbench/utils/env_dump/env_dump.so
-ENV,ENV_DUMP_FILE=report
-ENV,XDG_VTNR=1
-ENV,KDE_MULTIHEAD=false
-ENV,XDG_SESSION_ID=c1
-ENV,TERM=xterm
-ENV,SHELL=/bin/bash
-ENV,KONSOLE_DBUS_SERVICE=:1.32
-ENV,GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:/home/mupuf/.gtkrc-2.0:/home/mupuf/.config/gtkrc-2.0
-ENV,KONSOLE_PROFILE_NAME=Shell
-ENV,ACLOCAL=aclocal -I /home/mupuf/install/share/aclocal
-ENV,GTK_RC_FILES=/etc/gtk/gtkrc:/home/mupuf/.gtkrc:/home/mupuf/.config/gtkrc
-ENV,MESA_DEBUG=1
-ENV,GS_LIB=/home/mupuf/.fonts
-ENV,WINDOWID=71303198
-ENV,SHELL_SESSION_ID=7cd19f2c4e054000a020612a6f00374a
-ENV,GTK_MODULES=canberra-gtk-module
-ENV,KDE_FULL_SESSION=true
-ENV,NVD=/home/mupuf/install
-ENV,USER=mupuf
-ENV,LD_LIBRARY_PATH=/home/mupuf/install/lib
-ENV,XCURSOR_SIZE=24
-ENV,SSH_AUTH_SOCK=/tmp/ssh-f7fMDVJ2Hzsf/agent.864
-ENV,SESSION_MANAGER=local/beast:@/tmp/.ICE-unix/21516,unix/beast:/tmp/.ICE-unix/21516
-ENV,MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
-ENV,PATH=/home/mupuf/install/bin/:/home/mupuf/install/bin/:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/opt/vogl
-ENV,MAIL=/var/spool/mail/mupuf
-ENV,PWD=/home/mupuf/benchmarks/ezbench/utils/env_dump
-ENV,EDITOR=nano
-ENV,LANG=en_GB.UTF-8
-ENV,KDE_SESSION_UID=1000
-ENV,KONSOLE_DBUS_SESSION=/Sessions/2
-ENV,SSH_ASKPASS=/usr/bin/ksshaskpass
-ENV,SHLVL=5
-ENV,XDG_SEAT=seat0
-ENV,COLORFGBG=15;0
-ENV,HOME=/home/mupuf
-ENV,LANGUAGE=
-ENV,KDE_SESSION_VERSION=5
-ENV,XCURSOR_THEME=Breeze_Snow
-ENV,LOGNAME=mupuf
-ENV,DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-UUXbqWS2HW,guid=da94550fcaef7911bb07f9e45640cbe2
-ENV,XDG_DATA_DIRS=/usr/share:/usr/share:/usr/local/share
-ENV,PKG_CONFIG_PATH=/home/mupuf/install/lib/pkgconfig/:/home/mupuf/install/share/pkgconfig/
-ENV,WINDOWPATH=1
-ENV,DISPLAY=:0
-ENV,XDG_RUNTIME_DIR=/run/user/1000
-ENV,PROFILEHOME=
-ENV,XDG_CURRENT_DESKTOP=KDE
-ENV,XAUTHORITY=/tmp/xauth-1000-_0
-ENV,_=/usr/bin/xonotic-glx
-KERNEL,Linux,beast,4.2.5-1-ARCH,#1 SMP PREEMPT Tue Oct 27 08:13:28 CET 2015,x86_64,(none)
-SCHED,SCHED_OTHER,8,8,255,0
-CPU_FREQ,8,800000,4000000,800000,4000000,800000,4000000,800000,4000000,800000,4000000,800000,4000000,800000,4000000,800000,4000000
-THROTTLING,8,0,0,0,0,0,0,0,0,0
-INTEL_PSTATE,33,13,0,20,100
-BOOTLINK,linux-vdso.so.1,UNK,UNKNOWN_VERSION
-BOOTLINK,/home/mupuf/benchmarks/ezbench/utils/env_dump/env_dump.so,b53d74f5e0bf38f02ed0135489a7552857c78e3b,UNKNOWN_VERSION
-BOOTLINK,/usr/lib/libm.so.6,b7cf4803a0a49905d990adfcc56989721b156e71,Arch-glibc-2.22-3.x86_64
-BOOTLINK,/usr/lib/libz.so.1,a2f2ed3e528cee1527cf30a14f01ca246bf530b5,Arch-zlib-1.2.8-4.x86_64
-BOOTLINK,/usr/lib/libjpeg.so.8,12f18a159967f13e108fbba1fe2a5b95b59389e0,Arch-libjpeg-turbo-1.4.2-1.x86_64
-BOOTLINK,/usr/lib/librt.so.1,93294cf925d436e5167e0777ca875d7ca14647a8,Arch-glibc-2.22-3.x86_64
-BOOTLINK,/usr/lib/libdl.so.2,3e032a705b7724f27e78d4f078d7c6961ffd54e0,Arch-glibc-2.22-3.x86_64
-BOOTLINK,/usr/lib/libX11.so.6,70b697ed434727e99bbd3b8f2f486c9267690a56,Arch-libx11-1.6.3-1.x86_64
-BOOTLINK,/usr/lib/libXpm.so.4,fbbd6634d7edf3070bcd9b742e74a9a2d75e99b6,Arch-libxpm-3.5.11-1.x86_64
-BOOTLINK,/usr/lib/libXext.so.6,3359d6805126c28630c922219a6daaf9a5836f42,Arch-libxext-1.3.3-1.x86_64
-BOOTLINK,/usr/lib/libXxf86vm.so.1,4a916951fe388431de5448d9818e293b73191d32,Arch-libxxf86vm-1.1.4-1.x86_64
-BOOTLINK,/usr/lib/libasound.so.2,3791381047b0f3c25b9a808f8feeb0765ff07051,Arch-alsa-lib-1.0.29-1.x86_64
-BOOTLINK,/usr/lib/libpthread.so.0,54f2d4f765876c54194bed2964bdd1a0cdde03db,Arch-glibc-2.22-3.x86_64
-BOOTLINK,/usr/lib/libc.so.6,e3e01c77ab3d4d73ff3f969948465debaffa2b61,Arch-glibc-2.22-3.x86_64
-BOOTLINK,/lib64/ld-linux-x86-64.so.2,7911a1b3866a389fa9ad46a08432b7efe2639478,UNKNOWN_VERSION
-BOOTLINK,/usr/lib/libxcb.so.1,25ec0f295c31eebb496ba429d038348719724b35,Arch-libxcb-1.11.1-1.x86_64
-BOOTLINK,/usr/lib/libXau.so.6,df47f8963111fa3850a26fa61f0b4c137433a745,Arch-libxau-1.0.8-2.x86_64
-BOOTLINK,/home/mupuf/install/lib/libXdmcp.so.6,ba5e8960254ccfc4122af1fc1844e4c28b3efbab,git://anongit.freedesktop.org/xorg/lib/libXdmcp/master-b10f382
-BOOTLINK,/usr/lib/libbsd.so.0,599ee6ed3c735d0518829b3547cf9c45f344331e,Arch-libbsd-0.7.0-1.x86_64
-BOOTLINK,/usr/lib/libcrypto.so,211d0b48fb40546c8524303e67493819d531aea8,Arch-openssl-1.0.2.d-1.x86_64
-DYNLINK,/usr/lib/libd0_blind_id.so.0.0.0,99d9ef467ffce9a45fe80450daa7a17f674f96d2,Arch-xonotic-0.8.1-1.x86_64
-DYNLINK,/usr/lib/libd0_blind_id.so.0,99d9ef467ffce9a45fe80450daa7a17f674f96d2,Arch-xonotic-0.8.1-1.x86_64
-DYNLINK,/usr/lib/libgmp.so.10,d87b6bbdbc2fcbe4acd30dc2ef7a19a347147a4e,Arch-gmp-6.0.0-2.x86_64
-DYNLINK,/usr/lib/libcurl.so.4.4.0,1e13f692bda6d5905d1320e6d4b840edd3d0ba3b,Arch-curl-7.45.0-1.x86_64
-DYNLINK,/usr/lib/libcurl.so.4,1e13f692bda6d5905d1320e6d4b840edd3d0ba3b,Arch-curl-7.45.0-1.x86_64
-DYNLINK,/usr/lib/libidn.so.11,5a08d437b09087ada4f1b83168a1d87a5fac101b,Arch-libidn-1.32-1.x86_64
-DYNLINK,/usr/lib/libssh2.so.1,7d6f5792c906b3d83424d4f1d09ce8f00c5fa366,Arch-libssh2-1.6.0-1.x86_64
-DYNLINK,/usr/lib/libssl.so.1.0.0,8e4090c0889f6f75a896fafa3ec5d78052d032c3,Arch-openssl-1.0.2.d-1.x86_64
-DYNLINK,/usr/lib/libgssapi_krb5.so.2,503b9db4d5e1deabdcda54326d1e59785f10a703,Arch-krb5-1.13.2-1.x86_64
-DYNLINK,/usr/lib/libkrb5.so.3,3a5aa48c1bad6e58e3c7141abb655e4fa1691130,Arch-krb5-1.13.2-1.x86_64
-DYNLINK,/usr/lib/libk5crypto.so.3,cc9bee4d4e58ba0d54166f0407f3fcb00edb681e,Arch-krb5-1.13.2-1.x86_64
-DYNLINK,/usr/lib/libcom_err.so.2,0a5123fcad89311eba22dbc6cc5a5d1c8ce2f1da,Arch-e2fsprogs-1.42.13-1.x86_64
-DYNLINK,/usr/lib/libkrb5support.so.0,8c89d9855e5571df27350ed04448a2fadf3693d5,Arch-krb5-1.13.2-1.x86_64
-DYNLINK,/usr/lib/libkeyutils.so.1,a0fb75e3bb8a46c9c42aa2d370be99440470d550,Arch-keyutils-1.5.9-1.x86_64
-DYNLINK,/usr/lib/libresolv.so.2,a31a77f08069f211113d3aafb3d422c11694dd97,Arch-glibc-2.22-3.x86_64
-DYNLINK,/usr/lib/libvorbis.so.0.4.8,7fdd26b3895c1c8a1cdb0fc8d4523d6cb84beeff,Arch-libvorbis-1.3.5-1.x86_64
-DYNLINK,/usr/lib/libvorbis.so.0,7fdd26b3895c1c8a1cdb0fc8d4523d6cb84beeff,Arch-libvorbis-1.3.5-1.x86_64
-DYNLINK,/usr/lib/libogg.so.0,a58a93ec9181e3682b9bfdaa9041cf68d06bb9dd,Arch-libogg-1.3.2-1.x86_64
-DYNLINK,/usr/lib/libvorbisfile.so.3.3.7,ff1089401173f89b0d40aea11dfef9bbc151705c,Arch-libvorbis-1.3.5-1.x86_64
-DYNLINK,/usr/lib/libvorbisfile.so.3,ff1089401173f89b0d40aea11dfef9bbc151705c,Arch-libvorbis-1.3.5-1.x86_64
-DYNLINK,/usr/lib/libogg.so.0.8.2,a58a93ec9181e3682b9bfdaa9041cf68d06bb9dd,Arch-libogg-1.3.2-1.x86_64
-DYNLINK,/usr/lib/libtheora.so.0.3.10,20e4c310ee24d055476bc64f60a4c5d94b64070b,Arch-libtheora-1.1.1-3.x86_64
-DYNLINK,/usr/lib/libtheora.so.0,20e4c310ee24d055476bc64f60a4c5d94b64070b,Arch-libtheora-1.1.1-3.x86_64
-DYNLINK,/usr/lib/libvorbisenc.so.2.0.11,94c4a7c1a204be09463acefd151d9f1bc5665937,Arch-libvorbis-1.3.5-1.x86_64
-DYNLINK,/usr/lib/libvorbisenc.so.2,94c4a7c1a204be09463acefd151d9f1bc5665937,Arch-libvorbis-1.3.5-1.x86_64
-DYNLINK,/home/mupuf/install/lib/libGL.so.1.2.0,7cffd8343a755ac5cf93d9cf2cb2ee4c0ec9cbb8,ssh://mperes@people.freedesktop.org/~mperes/mesa.git/egl_dri3-a6f2d32
-DYNLINK,/home/mupuf/install/lib/libGL.so.1,7cffd8343a755ac5cf93d9cf2cb2ee4c0ec9cbb8,ssh://mperes@people.freedesktop.org/~mperes/mesa.git/egl_dri3-a6f2d32
-DYNLINK,/usr/lib/libexpat.so.1,084d5f181adc197d5cf12ba1e576b82ce9aa865e,Arch-expat-2.1.0-4.x86_64
-DYNLINK,/usr/lib/libxcb-dri3.so.0,1624047c67518e052720261f844562d82f9ead96,Arch-libxcb-1.11.1-1.x86_64
-DYNLINK,/usr/lib/libxcb-present.so.0,c430a8ae6fdef25763419d8c872e4e9694a9fd8c,Arch-libxcb-1.11.1-1.x86_64
-DYNLINK,/usr/lib/libxcb-randr.so.0,7105e21c07aaf7ab5ce9f919ceb966d64ea3c278,Arch-libxcb-1.11.1-1.x86_64
-DYNLINK,/usr/lib/libxcb-xfixes.so.0,192e198c8e5bbc73264b1072305c7a8a19c17ea6,Arch-libxcb-1.11.1-1.x86_64
-DYNLINK,/usr/lib/libxcb-render.so.0,8a3a44d2ddb3ee7bb729d086b4017caf454faa3b,Arch-libxcb-1.11.1-1.x86_64
-DYNLINK,/usr/lib/libxcb-shape.so.0,468d3168d4cea5fc68a7ad5f6ce0145f08cb7919,Arch-libxcb-1.11.1-1.x86_64
-DYNLINK,/usr/lib/libxcb-sync.so.1,1b65ffe57b8f7bd2b233f9f44a6dcaa4acba644b,Arch-libxcb-1.11.1-1.x86_64
-DYNLINK,/usr/lib/libxshmfence.so.1,a2a173f77eb3c34e6022780a3ca2ea778472be54,Arch-libxshmfence-1.2-1.x86_64
-DYNLINK,/home/mupuf/install/lib/libglapi.so.0,d52b4ce373af37e32a52c48aca47c4a4a873edd1,ssh://mperes@people.freedesktop.org/~mperes/mesa.git/egl_dri3-a6f2d32
-DYNLINK,/usr/lib/libXdamage.so.1,5628004f4fe77abeca831a8ead1c24e54ed3890a,Arch-libxdamage-1.1.4-2.x86_64
-DYNLINK,/usr/lib/libXfixes.so.3,c116fb23a09d318ea0d32012374a0b4819529c8d,Arch-libxfixes-5.0.1-1.x86_64
-DYNLINK,/usr/lib/libX11-xcb.so.1,a5cce5a5e2d6a6c3f8e4d9a31c9ef0445f63b4b3,Arch-libx11-1.6.3-1.x86_64
-DYNLINK,/usr/lib/libxcb-glx.so.0,ea5dc27e4bae75cdff70216ebeaffccfc22ce1bb,Arch-libxcb-1.11.1-1.x86_64
-DYNLINK,/usr/lib/libxcb-dri2.so.0,24ff4164929f13a15ec65336a836739f6f557d55,Arch-libxcb-1.11.1-1.x86_64
-DYNLINK,/home/mupuf/install/lib/libdrm.so.2,e26b62afaa450ad5b9c9d606e4603d51bea7cc71,ssh://mperes@people.freedesktop.org/~mperes/drm/master: ahead 226-3045523
-SOCKET_UNIX_CONNECT,/tmp/.X11-unix/X0,/home/mupuf/install/lib/xorg-server/Xorg,'/home/mupuf/install/lib/xorg-server/Xorg' '-nolisten' 'tcp' ':0' 'vt1' '-auth' '/tmp/serverauth.9qXVoDcHr7',a3e0e9075ef5f32991e2b9890d60c6d102d5faa6,ssh://mperes@people.freedesktop.org/~mperes/xserver/master: ahead 270, behind 3-c99fb55
-XORG_SESSION_OPENED,(null)
-XORG_DISPLAY,0,KWin,3120,1920,24
-DYNLINK,/usr/lib/libudev.so.1.6.4,6587c22b9f0ba359d68a6315cc7f24284664f52f,Arch-libsystemd-227-1.x86_64
-DYNLINK,/usr/lib/libudev.so.1,6587c22b9f0ba359d68a6315cc7f24284664f52f,Arch-libsystemd-227-1.x86_64
-DYNLINK,/usr/lib/libcap.so.2,0e11f218f90843afb6359c1d1856d974a1d9fe58,Arch-libcap-2.24-2.x86_64
-DYNLINK,/usr/lib/libattr.so.1,f0cdbed41dcfb9772873406569fac2e155abd222,Arch-attr-2.4.47-1.x86_64
-DYNLINK,/home/mupuf/install/lib/dri/i965_dri.so,7f46e221c0eae5219f642e9e7e98507ad9928fc4,ssh://mperes@people.freedesktop.org/~mperes/mesa.git/egl_dri3-a6f2d32
-DYNLINK,/home/mupuf/install/lib/dri//i965_dri.so,7f46e221c0eae5219f642e9e7e98507ad9928fc4,ssh://mperes@people.freedesktop.org/~mperes/mesa.git/egl_dri3-a6f2d32
-DYNLINK,/usr/lib/libnettle.so.6,141b6bf17aa0176724a3b913150db7b566e75674,Arch-nettle-3.1.1-1.x86_64
-DYNLINK,/home/mupuf/install/lib/libdrm_intel.so.1,d2ba16b233cf260e12977b71358266c6e306e058,ssh://mperes@people.freedesktop.org/~mperes/drm/master: ahead 226-3045523
-DYNLINK,/usr/lib/libpciaccess.so.0,035c8ad06e10405e5b850af23f98ff6eff03c96c,Arch-libpciaccess-0.13.4-1.x86_64
-DYNLINK,/usr/lib/libstdc++.so.6,130106e6ae93ddb4796ea583e1cdddfaf5257b35,Arch-gcc-libs-multilib-5.2.0-2.x86_64
-DYNLINK,/usr/lib/libgcc_s.so.1,36183ac5fa1774a8591c6bbb473d959077f3bb6e,Arch-gcc-libs-multilib-5.2.0-2.x86_64
-IOCTL,/dev/dri/renderD128
-LIBDRM,1,3,0
-DRM,1,6,0,i915,20150522,Intel Graphics,0x8086,0x0412,hsw_gt2,Intel(R) Haswell Desktop
-INTEL_DRM,450,1200,1200,350,200
-XORG_WINDOW_CREATE,215,4194306,3120,1920,24
-DYNLINK,/usr/lib/libXcursor.so.1.0.2,c5cf29c97803bef02c8845fe83646b9d25ade4ee,Arch-libxcursor-1.1.14-2.x86_64
-DYNLINK,/usr/lib/libXcursor.so.1,c5cf29c97803bef02c8845fe83646b9d25ade4ee,Arch-libxcursor-1.1.14-2.x86_64
-DYNLINK,/usr/lib/libXrender.so.1,0ae36e0af4c2385084bc7b6cfd77289bb2a0b746,Arch-libxrender-0.9.9-1.x86_64
-DYNLINK,/usr/lib/libtxc_dxtn.so,61959dd2bc5b130891e44c780d9a2d0ce74b6b3c,Arch-libtxc_dxtn-1.0.1-6.x86_64
-DYNLINK,/usr/lib/libpng16.so.16.18.0,6b0396a700ac3de412f727f9ca2755654275fe3d,Arch-libpng-1.6.18-1.x86_64
-DYNLINK,/usr/lib/libpng16.so.16,6b0396a700ac3de412f727f9ca2755654275fe3d,Arch-libpng-1.6.18-1.x86_64
-DYNLINK,/usr/lib/libfreetype.so.6.12.1,fcd097713f4ffb9250791ea46728240a5bd807ab,Arch-freetype2-2.6.1-1.x86_64
-DYNLINK,/usr/lib/libfreetype.so.6,fcd097713f4ffb9250791ea46728240a5bd807ab,Arch-freetype2-2.6.1-1.x86_64
-DYNLINK,/usr/lib/libbz2.so.1.0,a1f1a03092277b1a9033bdde5b891e0c93367372,Arch-bzip2-1.0.6-5.x86_64
-DYNLINK,/usr/lib/libharfbuzz.so.0,8a36a67c2dc4956756296836957885815576d9bf,Arch-harfbuzz-1.0.6-2.x86_64
-DYNLINK,/usr/lib/libglib-2.0.so.0,2d4db66da30dca7d000053f67659081b7ed41ff1,Arch-glib2-2.46.1-1.x86_64
-DYNLINK,/usr/lib/libgraphite2.so.3,dfd45840fa8b87be8b8dfba5ac049e3a349198a5,Arch-graphite-1:1.3.3-1.x86_64
-DYNLINK,/usr/lib/libpcre.so.1,5cbf4c5a40574ed70aff464dbf590a981eba40b9,Arch-pcre-8.37-4.x86_64
-DYNLINK,/usr/lib/libasound.so.2.0.0,3791381047b0f3c25b9a808f8feeb0765ff07051,Arch-alsa-lib-1.0.29-1.x86_64
-DYNLINK,/usr/lib/alsa-lib/libasound_module_pcm_pulse.so,b876d8ed3ff4afe990f5010bded42bc155f43d8e,Arch-alsa-plugins-1.0.29-2.x86_64
-DYNLINK,/usr/lib/libpulse.so.0,c353a67917100f0dbe298a16f6a9a31dc9a218ea,Arch-libpulse-7.1-1.x86_64
-DYNLINK,/usr/lib/pulseaudio/libpulsecommon-7.1.so,e6017b3fedf6c2eb9a00924ad49063715d1975a3,Arch-libpulse-7.1-1.x86_64
-DYNLINK,/usr/lib/libjson-c.so.2,c3067219d38425f9694574175bb8cb76cb291439,Arch-json-c-0.12-2.x86_64
-DYNLINK,/usr/lib/libdbus-1.so.3,57557f9ce8961062342bd15363a55890c7646f91,Arch-libdbus-1.10.2-1.x86_64
-DYNLINK,/usr/lib/libsystemd.so.0,2805f47aa8a276f5232469836286162e26de04c1,Arch-libsystemd-227-1.x86_64
-DYNLINK,/usr/lib/libsndfile.so.1,15ac12c40a9a8eba4557ded4816b4b115440cb14,Arch-libsndfile-1.0.25-3.x86_64
-DYNLINK,/usr/lib/libasyncns.so.0,5898825647e02c6a4713b0c84d51540f3398d7f3,Arch-libasyncns-0.8-5.x86_64
-DYNLINK,/usr/lib/liblzma.so.5,5f0042e5eeb74a2cde80160b5dc469a5b1879123,Arch-xz-5.2.2-1.x86_64
-DYNLINK,/usr/lib/liblz4.so.1,044a31894df0f640c1280dc0bca6da5c287a6ff4,Arch-lz4-131-1.x86_64
-DYNLINK,/usr/lib/libgcrypt.so.20,a5961be4e46cbfc71417e24d7848cccb2d6eea29,Arch-libgcrypt-1.6.4-1.x86_64
-DYNLINK,/usr/lib/libgpg-error.so.0,4db3e11bf9cab86fdb60024be8d71fbc94ce0edf,Arch-libgpg-error-1.20-1.x86_64
-DYNLINK,/usr/lib/libFLAC.so.8,6f712553fc15a0ffd9517abe8568cfeb708561b9,Arch-flac-1.3.1-1.x86_64
-DYNLINK,/usr/lib/libnsl.so.1,f6fe7165c7ca1a143583ec61de4523048ee3b31b,Arch-glibc-2.22-3.x86_64
-SOCKET_UNIX_CONNECT,/tmp/.X11-unix/X0,/home/mupuf/install/lib/xorg-server/Xorg,'/home/mupuf/install/lib/xorg-server/Xorg' '-nolisten' 'tcp' ':0' 'vt1' '-auth' '/tmp/serverauth.9qXVoDcHr7',a3e0e9075ef5f32991e2b9890d60c6d102d5faa6,ssh://mperes@people.freedesktop.org/~mperes/xserver/master: ahead 270, behind 3-c99fb55
-SOCKET_UNIX_CONNECT,/run/user/1000/pulse/native,/usr/lib/systemd/systemd,'/usr/lib/systemd/systemd' '--user',68cbcef676aff69e9e72697c30e9f3af0012a663,Arch-systemd-227-1.x86_64
-IOCTL,/dev/sr0
-IOCTL,socket:[642525]
-IOCTL,socket:[640914]
-XORG_CLOSE,:0
-THROTTLING,8,0,0,0,0,0,0,0,0,0
--- Env dump end --
-
-That's it for now, folks!
diff --git a/utils/env_dump/cpu.c b/utils/env_dump/cpu.c
deleted file mode 100644
index e4d1399..0000000
--- a/utils/env_dump/cpu.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/* Copyright (c) 2015, Intel Corporation
- *
- * 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.
- */
-
-#define _GNU_SOURCE
-
-#include "env_dump.h"
-
-#include <sys/resource.h>
-#include <sys/sysinfo.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <malloc.h>
-#include <stdint.h>
-#include <sched.h>
-
-
-char *
-_env_dump_read_file(const char *path, size_t len_max)
-{
- size_t len;
- char *buf;
-
- FILE *file = fopen(path, "r");
- if (!file)
- return NULL;
-
- buf = calloc(len_max, sizeof(char));
- if (!buf) {
- fclose(file);
- return buf;
- }
-
- len = fread(buf, 1, len_max, file);
-
- /* get rid of the final \n */
- if (len > 0 && buf[len - 1] == '\n')
- buf[len - 1] = '\0';
-
- return buf;
-}
-
-static void
-dump_cpu_common()
-{
- char *path = malloc(255);
- int i;
-
- fprintf(env_file, "CPU_FREQ,%i", get_nprocs_conf());
- for (i = 0; i < get_nprocs_conf(); i++) {
- char *min, *max;
- snprintf(path, 255,
- "/sys/devices/system/cpu/cpu%i/cpufreq/scaling_min_freq",
- i);
- min = _env_dump_read_file(path, 20);
-
- snprintf(path, 255,
- "/sys/devices/system/cpu/cpu%i/cpufreq/scaling_max_freq",
- i);
- max = _env_dump_read_file(path, 20);
-
- fprintf(env_file, ",%s,%s", min, max);
- free(min);
- free(max);
- }
- fprintf(env_file, "\n");
-
- free(path);
-}
-
-static void
-dump_shed_common()
-{
- uint64_t affinity = 0;
- const char *sched_str;
- int prio, sched, i;
- cpu_set_t cpu_set;
-
- /* FIXME: This does not work when having more than 64 CPUs */
- sched_getaffinity(0, sizeof(cpu_set), &cpu_set);
- for (i = 0; i < 64; i++) {
- affinity |= (CPU_ISSET(i, &cpu_set) != 0) << i;
- }
-
- sched = sched_getscheduler(0);
- switch (sched) {
- case SCHED_OTHER:
- sched_str = "SCHED_OTHER";
- break;
- case SCHED_BATCH:
- sched_str = "SCHED_BATCH";
- break;
- case SCHED_IDLE:
- sched_str = "SCHED_IDLE";
- break;
- case SCHED_FIFO:
- sched_str = "SCHED_FIFO";
- break;
- case SCHED_RR:
- sched_str = "SCHED_RR";
- break;
- case -1:
- sched_str = "ERROR";
- break;
- default:
- sched_str = "UNKNOWN";
- break;
- }
-
- prio = getpriority(PRIO_PROCESS, 0);
-
- fprintf(env_file, "SCHED,%s,%i,%i,%lu,%i\n", sched_str,
- get_nprocs_conf(), get_nprocs(), affinity, prio);
-}
-
-static void
-dump_throttling_common()
-{
- char *package, *path = malloc(255);
- int i;
-
- package = _env_dump_read_file("/sys/devices/system/cpu/cpu0/thermal_throttle/package_throttle_count", 20);
-
- fprintf(env_file, "THROTTLING,%i,%s", get_nprocs_conf(), package);
- for (i = 0; i < get_nprocs_conf(); i++) {
- char *core;
- snprintf(path, 255,
- "/sys/devices/system/cpu/cpu%i/thermal_throttle/core_throttle_count",
- i);
- core = _env_dump_read_file(path, 20);
- fprintf(env_file, ",%s", core);
- free(core);
- }
- fprintf(env_file, "\n");
-
- free(path);
-}
-
-static void
-dump_intel_pstate()
-{
- struct stat pstate_dir;
- char *num_pstates, *turbo_pct, *min, *max, *turbo;
-
- /* check that the intel pstate governor is being used */
- if (stat("/sys/devices/system/cpu/intel_pstate/", &pstate_dir))
- return;
-
- /* read the different values */
- num_pstates = _env_dump_read_file("/sys/devices/system/cpu/intel_pstate/num_pstates", 10);
- turbo_pct = _env_dump_read_file("/sys/devices/system/cpu/intel_pstate/turbo_pct", 10);
- min = _env_dump_read_file("/sys/devices/system/cpu/intel_pstate/min_perf_pct", 4);
- max = _env_dump_read_file("/sys/devices/system/cpu/intel_pstate/max_perf_pct", 4);
- turbo = _env_dump_read_file("/sys/devices/system/cpu/intel_pstate/no_turbo", 2);
-
- fprintf(env_file, "INTEL_PSTATE,%s,%s,%s,%s,%s\n", num_pstates,
- turbo_pct, turbo, min, max);
-
- free(num_pstates); free(turbo_pct); free(min); free(max); free(turbo);
-}
-
-void
-_env_dump_cpu_init()
-{
- dump_shed_common();
- dump_cpu_common();
- dump_throttling_common();
- dump_intel_pstate();
-}
-
-void
-_env_dump_cpu_fini()
-{
- dump_throttling_common();
-} \ No newline at end of file
diff --git a/utils/env_dump/drm.c b/utils/env_dump/drm.c
deleted file mode 100644
index 5416dfa..0000000
--- a/utils/env_dump/drm.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/* Copyright (c) 2015, Intel Corporation
- *
- * 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.
- */
-
-#define _GNU_SOURCE
-
-#include "env_dump.h"
-
-#include <xf86drm.h>
-#include <stdlib.h>
-#include <string.h>
-
-static char *
-read_drm_sysfs(const char *node, const char *file, size_t len_max)
-{
- char sysfs_path[101];
-
- snprintf(sysfs_path, sizeof(sysfs_path), "/sys/class/drm/%s/%s", node, file);
- return _env_dump_read_file(sysfs_path, len_max);
-}
-
-static long
-read_drm_sysfs_int(const char *node, const char *file, int base)
-{
- char *val = read_drm_sysfs(node, file, 20);
- long ret = -1;
-
- if (val) {
- ret = strtol(val, NULL, base);
- free(val);
- }
-
- return ret;
-
-}
-
-static void
-_env_dump_drm_i915_dump_info(const char *node_name,
- const char *primary_node_name, int fd)
-{
- long min, max, rp0, rp1, rpn;
-
- min = read_drm_sysfs_int(primary_node_name, "gt_min_freq_mhz", 10);
- max = read_drm_sysfs_int(primary_node_name, "gt_max_freq_mhz", 10);
- rp0 = read_drm_sysfs_int(primary_node_name, "gt_RP0_freq_mhz", 10);
- rp1 = read_drm_sysfs_int(primary_node_name, "gt_RP1_freq_mhz", 10);
- rpn = read_drm_sysfs_int(primary_node_name, "gt_RPn_freq_mhz", 10);
-
- fprintf(env_file, "INTEL_DRM,%li,%li,%li,%li,%li\n", min, max, rp0, rp1, rpn);
-}
-
-void
-_env_dump_drm_dump_info(const char *path, int fd)
-{
- char *(*orig_drmGetPrimaryDeviceNameFromFd)(int fd);
- drmVersionPtr (*orig_drmGetLibVersion)(int fd);
- drmVersionPtr (*orig_drmGetVersion)(int fd);
- void (*orig_drmFreeVersion)(drmVersionPtr v);
- drmVersionPtr version_lib = NULL, version_drm = NULL;
- char *node_name = NULL, *primary_node = NULL, *primary_node_name = NULL;
- char *vendor = NULL, *devid = NULL;
-
- /* resolve symbols */
- orig_drmGetPrimaryDeviceNameFromFd = _env_dump_resolve_symbol_by_name("drmGetPrimaryDeviceNameFromFd");
- orig_drmGetVersion = _env_dump_resolve_symbol_by_name("drmGetVersion");
- orig_drmGetLibVersion = _env_dump_resolve_symbol_by_name("drmGetLibVersion");
- orig_drmFreeVersion = _env_dump_resolve_symbol_by_name("drmFreeVersion");
- if (!orig_drmGetPrimaryDeviceNameFromFd || !orig_drmGetVersion ||
- !orig_drmGetLibVersion || !orig_drmFreeVersion)
- return;
-
- /* Check if the path starts with /, as it should be */
- if (path[0] != '/')
- goto exit;
-
- /* Get the general DRM information */
- primary_node = orig_drmGetPrimaryDeviceNameFromFd(fd);
- node_name = strrchr(path, '/');
- if (!node_name || !primary_node)
- goto exit;
-
- primary_node_name = strrchr(primary_node, '/');
- version_lib = orig_drmGetLibVersion(fd);
- version_drm = orig_drmGetVersion(fd);
- if (!primary_node_name || !version_lib || !version_drm)
- goto exit;
-
- /* get rid of the '/' in the name */
- node_name++;
- primary_node_name++;
-
- /* fetch the BusID */
- vendor = read_drm_sysfs(node_name, "device/vendor", 16);
- devid = read_drm_sysfs(node_name, "device/device", 16);
-
- fprintf(env_file, "LIBDRM,%i,%i,%i\n", version_lib->version_major,
- version_lib->version_minor,
- version_lib->version_patchlevel);
- fprintf(env_file, "DRM,%i,%i,%i,%s,%s,%s,%s,%s\n",
- version_drm->version_major, version_drm->version_minor,
- version_drm->version_patchlevel, version_drm->name,
- version_drm->date, version_drm->desc, vendor, devid);
-
- free(vendor); free(devid);
-
- /* Add data, per vendor */
- if (strcmp(version_drm->name, "i915") == 0)
- _env_dump_drm_i915_dump_info(node_name, primary_node_name, fd);
-
-exit:
- if (primary_node)
- free(primary_node);
- if (version_lib)
- orig_drmFreeVersion(version_lib);
- if (version_drm)
- orig_drmFreeVersion(version_drm);
-} \ No newline at end of file
diff --git a/utils/env_dump/env_dump.c b/utils/env_dump/env_dump.c
deleted file mode 100644
index cd65b81..0000000
--- a/utils/env_dump/env_dump.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/* Copyright (c) 2015, Intel Corporation
- *
- * 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.
- */
-
-#define _GNU_SOURCE
-
-#include "env_dump.h"
-
-#include <sys/stat.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <time.h>
-#include <link.h>
-
-FILE *env_file = NULL;
-
-static void fini();
-
-/* Yes, the program may call _exit() and in this case, the fini() function will
- * never be called. Fix this!
- */
-void _exit(int status)
-{
- void (*const orig__exit)(int) = _env_dump_resolve_symbol_by_name("_exit");
- fini();
- orig__exit(status);
-}
-
-/* handle exit signals to run the fini() functions */
-static void
-sig_handler(int sig, siginfo_t *siginfo, void *context)
-{
- /* this will also call fini! */
- _exit(-1);
-}
-
-static void
-register_signal_handler(int signal)
-{
- struct sigaction act;
- memset (&act, '\0', sizeof(act));
- act.sa_sigaction = &sig_handler;
- act.sa_flags = SA_SIGINFO;
- if (sigaction(signal, &act, NULL) < 0) {
- perror ("sigaction");
- }
-}
-
-static void
-print_date_and_time()
-{
- struct tm* tm_info;
- time_t timer;
- char buf[51];
-
- time(&timer);
- tm_info = localtime(&timer);
-
- strftime(buf, sizeof(buf), "%Y:%m:%d,%H:%M:%S,%Z(%z)", tm_info);
-
- fprintf(env_file, "DATE,%s\n", buf);
-}
-
-__attribute__((constructor))
-static void init() {
- const char *base_path = getenv("ENV_DUMP_FILE");
- char *path;
- int fd;
-
- if (base_path == NULL)
- base_path = "/tmp/env_dump";
-
- if (strcmp(base_path, "stderr") != 0) {
- /* if the file asked by the user already exists, append the pid to the
- * name. Otherwise, just use the name.
- */
- fd = open(base_path, O_EXCL | O_CREAT | O_WRONLY, 0666);
- if (fd >= 0) {
- env_file = fdopen(fd, "w");
- fprintf(stderr, "path = %s\n", base_path);
- } else {
- path = malloc(strlen(base_path) + 1 + 10 + 1); /* log(2^32) = 10 */
- if (!path)
- exit(1);
- sprintf(path, "%s.%i", base_path, getpid());
- fprintf(stderr, "path = %s.%i\n", base_path, getpid());
- env_file = fopen(path, "w");
- free(path);
- }
- /* do not buffer this stream */
- setvbuf(env_file, (char *)NULL, _IONBF, 0);
- } else {
- env_file = stderr;
- }
-
- /* handle some signals that would normally result in an exit without
- * calling the fini functions. This will hopefully be done before any
- * other library does it. It is however OK if the program replaces the
- * handler as long as it calls exit() or _exit().
- */
- register_signal_handler(SIGHUP);
- register_signal_handler(SIGINT);
- register_signal_handler(SIGPIPE);
- register_signal_handler(SIGTERM);
-
- fprintf(env_file, "-- Env dump start (version 1) --\n");
-
- print_date_and_time();
-
- _env_dump_posix_env_init();
- _env_dump_fd_init();
- _env_dump_gl_init();
- _env_dump_linux_init();
- _env_dump_cpu_init();
- _env_dump_libs_init();
- _env_dump_net_init();
-}
-
-__attribute__((destructor))
-static void fini() {
- _env_dump_net_fini();
- _env_dump_libs_fini();
- _env_dump_cpu_fini();
- _env_dump_linux_fini();
- _env_dump_gl_fini();
- _env_dump_fd_init();
- _env_dump_posix_env_fini();
-
- fprintf(env_file, "-- Env dump end --\n");
- fclose(env_file);
-}
diff --git a/utils/env_dump/env_dump.h b/utils/env_dump/env_dump.h
deleted file mode 100644
index 3b03ad6..0000000
--- a/utils/env_dump/env_dump.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Copyright (c) 2015, Intel Corporation
- *
- * 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.
- */
-
-#ifndef _ENV_DUMP_H_
-#define _ENV_DUMP_H_
-
-#include <GL/glx.h>
-#include <stdio.h>
-
-extern FILE *env_file;
-
-#define likely(x) __builtin_expect(!!(x), 1)
-#define unlikely(x) __builtin_expect(!!(x), 0)
-
-typedef void (*fd_callback)(int fd, void *user);
-
-void _env_dump_libs_init();
-void _env_dump_libs_fini();
-
-void _env_dump_cpu_init();
-void _env_dump_cpu_fini();
-
-void _env_dump_drm_dump_info(const char *path, int fd);
-
-void _env_dump_fd_init();
-void _env_dump_fd_fini();
-void _env_dump_close_callback(int fd, fd_callback cb, void *user);
-
-void _env_dump_gl_init();
-void _env_dump_gl_fini();
-
-void _env_dump_linux_init();
-void _env_dump_linux_fini();
-
-void _env_dump_net_init();
-void _env_dump_net_fini();
-
-void _env_dump_posix_env_init();
-void _env_dump_posix_env_fini();
-
-void _env_dump_compute_and_print_sha1(const char *full_path);
-void env_var_dump_binary_information(int pid);
-
-char *_env_dump_read_file(const char *path, size_t len_max);
-
-/* internal pointer-tracking mechanism */
-enum symbol_key_t {
- SYMB_IOCTL = 0,
- SYMB_GLXSWAPBUFFERS,
- SYMB_EGLSWAPBUFFERS,
- SYMB_GLXMAKECURRENT,
- SYMB_EGLMAKECURRENT,
- SYMB_END
-}; /* do not forget to duplicate the name in libs.c's symbol_key_str */
-
-void *_env_dump_resolve_local_symbol_by_name(const char *symbol);
-void *_env_dump_resolve_symbol_by_name(const char *symbol);
-void *_env_dump_resolve_symbol_by_id(enum symbol_key_t symbol);
-void _env_dump_replace_symbol(const char *symbol, void *ptr);
-
-#endif
diff --git a/utils/env_dump/env_dump.sh b/utils/env_dump/env_dump.sh
deleted file mode 100755
index 7c906d7..0000000
--- a/utils/env_dump/env_dump.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-
-if [ $# -eq 0 ]
-then
- echo "Usage: $0 env_dump_file binary param1 param2 ..."
-fi
-
-dir=$(dirname $(readlink -f $0))
-so_path="$dir/env_dump.so"
-dump_file="$1"
-shift
-
-LD_PRELOAD="$so_path" ENV_DUMP_FILE="$dump_file" "$@"
-exit $?
diff --git a/utils/env_dump/env_dump_extend.sh b/utils/env_dump/env_dump_extend.sh
deleted file mode 100755
index 465a097..0000000
--- a/utils/env_dump/env_dump_extend.sh
+++ /dev/null
@@ -1,194 +0,0 @@
-#!/bin/bash
-
-# Requires pkcon from packagekit, the file /etc/lsb-release, dmidecode and msr-tools
-
-if [[ $# -ne 2 ]]
-then
- echo "Usage: $0 SHA1_DB env_dump_file"
-fi
-
-SHA1_DB="$1"
-dump_file="$2"
-
-root_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-function get_binary_version() {
- filename=$1
- sha1=$2
-
- upstream=$($SHA1_DB/sha1_db $SHA1_DB $sha1 read_attr upstream 2> /dev/null)
- version=$($SHA1_DB/sha1_db $SHA1_DB $sha1 read_attr version 2> /dev/null)
-
- if [ -n "$upstream" ] && [ -n "$version" ]; then
- echo $upstream-$version
- return 0
- else
- # We did not find the file, add it to the sha1 DB. First check if it was
- # provided by the distro
- if [[ $distro =~ ^Ubuntu ]]; then
- pkg=$(dpkg -S $filename 2> /dev/null | cut -d ':' -f 2 | xargs)
- else
- pkg=$(pkcon search file $filename 2> /dev/null | grep Installed | xargs | cut -d ' ' -f 2)
- fi
- [ -z "$pkg" ] && echo "UNKNOWN_VERSION" && return 1
-
- # Now check that the SHA1 still matches the one used by the benchmark
- if [ "$sha1" == $(sha1sum $filename | cut -d ' ' -f 1) ]
- then
- $SHA1_DB/sha1_db $SHA1_DB $sha1 add $pkg $filename $distro > /dev/null
- echo $distro-$pkg
- return 0
- fi
- fi
-}
-
-function resolve_SHA1() {
- SHA1_DB="$1"
- dump_file="$2"
-
- [ -z "$SHA1_DB" ] && return 0
-
- # Try to get the name of the distro from lsb-release, revert to pkcon if not
- # available
- distro=$(grep DISTRIB_ID /etc/lsb-release 2> /dev/null | cut -d '=' -f2)
- distro_version=$(grep DISTRIB_RELEASE /etc/lsb-release 2> /dev/null | cut -d '=' -f2)
- if [ -z "$distro" ]
- then
- distro=$(pkcon backend-details 2> /dev/null | grep Name | xargs | cut -d ' ' -f 2)
- [ -z "$distro" ] && distro="UNK_DISTRO"]
- elif [ -n "$distro_version" ] && [ "$distro_version" != "rolling" ]
- then
- distro="${distro}_${distro_version}"
- fi
-
- # resolve the SHA1 of the EXE
- exe_line=$(grep -e '^EXE,' $dump_file)
- filename=$(echo "$exe_line" | cut -d ',' -f 2)
- sha1=$(echo "$exe_line" | cut -d ',' -f 4)
- version=$(get_binary_version $filename $sha1)
- sed -i "s\`$exe_line\`$exe_line,$version\`g" $dump_file
-
- # resolve the SHA1 of the libraries
- for line in $(grep -e '^BOOTLINK\|^DYNLINK,' $dump_file)
- do
- filename=$(echo "$line" | cut -d ',' -f 2)
- sha1=$(echo "$line" | cut -d ',' -f 3)
- version=$(get_binary_version $filename $sha1)
- sed -i "s\`$line\`$line,$version\`g" $dump_file
- done
-
- # resolve the SHA1 of the binary on the other side of a unix socket
- grep -e '^SOCKET_UNIX_CONNECT,' $dump_file | while read line
- do
- filename=$(echo "$line" | cut -d ',' -f 3)
- sha1=$(echo "$line" | cut -d ',' -f 5)
- version=$(get_binary_version $filename $sha1)
- sed -i "s\`$line\`$line,$version\`g" $dump_file
- done
-
- return 0
-}
-
-function add_dmidecode_info() {
- dimdecode=$(sudo -n dmidecode 2> /dev/null)
-
- # test if dmidecode ran properly
- [ $? -ne 0 ] && echo "WARNING; dmidecode is not present or not working..." && return 0
-
- # Motherboard information
- mobo_info=$(echo "$dimdecode" | grep -A 3 "Base Board Information")
- manufacturer=$(echo "$mobo_info" | grep "Manufacturer:" | cut -d ':' -f 2- | xargs)
- product_name=$(echo "$mobo_info" | grep "Product Name:" | cut -d ':' -f 2- | xargs)
- version=$(echo "$mobo_info" | grep "Version:" | cut -d ':' -f 2- | xargs)
- mobo_info=$(echo "MOTHERBOARD,$manufacturer,$product_name,$version\n")
-
- # BIOS information
- bios_info=$(echo "$dimdecode" | grep -A 6 "BIOS Information")
- vendor=$(echo "$bios_info" | grep "Vendor:" | cut -d ':' -f 2- | xargs)
- version=$(echo "$bios_info" | grep "Version:" | cut -d ':' -f 2- | xargs)
- date=$(echo "$bios_info" | grep "Release Date:" | cut -d ':' -f 2- | xargs)
- bios_info=$(echo "BIOS,$vendor,$version,$date\n")
-
- # CPU information
- cpu_count=$(echo "$dimdecode" | grep "Processor Information" | wc -l)
- grep_lines=$(echo "$dimdecode" | sed -n '/Processor Information/!b;:a;/Handle 0x/!{$!{N;ba}};{/Processor Information/p}' | wc -l)
- cpu_max=$((cpu_count - 1))
- cpu_info=""
- for i in $(seq 0 $cpu_max)
- do
- e=$(($i + 1))
-
- manufacturer=$(echo "$dimdecode" | grep -m $e -A $grep_lines "Processor Information$" | grep "Manufacturer:" | tail -n 1 | cut -d ':' -f 2- | xargs)
- id=$(echo "$dimdecode" | grep -m $e -A $grep_lines "Processor Information$" | grep "ID:" | tail -n 1 | cut -d ':' -f 2- | xargs)
- version=$(echo "$dimdecode" | grep -m $e -A $grep_lines "Processor Information$" | grep "Version:" | tail -n 1 | cut -d ':' -f 2- | xargs)
- max_speed=$(echo "$dimdecode" | grep -m $e -A $grep_lines "Processor Information$" | grep "Max Speed:" | tail -n 1 | cut -d ':' -f 2- | xargs)
- core_count=$(echo "$dimdecode" | grep -m $e -A $grep_lines "Processor Information$" | grep "Core Count" | tail -n 1 | cut -d ':' -f 2- | xargs)
- thread_count=$(echo "$dimdecode" | grep -m $e -A $grep_lines "Processor Information$" | grep "Thread Count:" | tail -n 1 | cut -d ':' -f 2- | xargs)
-
- l1_handle=$(echo "$dimdecode" | grep -m $e -A $grep_lines "Processor Information$" | grep "L1 Cache Handle:" | tail -n 1 | cut -d ':' -f 2- | xargs)
- l2_handle=$(echo "$dimdecode" | grep -m $e -A $grep_lines "Processor Information$" | grep "L2 Cache Handle:" | tail -n 1 | cut -d ':' -f 2- | xargs)
- l3_handle=$(echo "$dimdecode" | grep -m $e -A $grep_lines "Processor Information$" | grep "L3 Cache Handle:" | tail -n 1 | cut -d ':' -f 2- | xargs)
-
- l1_size=$(echo "$dimdecode" | grep -A 15 "Handle $l1_handle" | grep "Installed Size:" | tail -n 1 | cut -d ':' -f 2- | xargs)
- l2_size=$(echo "$dimdecode" | grep -A 15 "Handle $l2_handle" | grep "Installed Size:" | tail -n 1 | cut -d ':' -f 2- | xargs)
- l3_size=$(echo "$dimdecode" | grep -A 15 "Handle $l3_handle" | grep "Installed Size:" | tail -n 1 | cut -d ':' -f 2- | xargs)
-
- if [ "$msr_loaded" -eq 1 ] && [[ "$manufacturer" == "Intel" ]]
- then
- # See table 35-2 of the IA-32
- virt_enabled=$((($(sudo -n rdmsr -p $i 0x3A) & 0x4) != 0))
- else
- virt_enabled="-1"
- fi
-
- cpu_info=$(echo "${cpu_info}PROCESSOR,$i,$manufacturer,$id,$version,$core_count,$thread_count,$l1_size,$l2_size,$l3_size,$max_speed,$virt_enabled\n")
- done
-
- # RAM information
- stick_count=$(echo "$dimdecode" | grep "Memory Device$" | wc -l)
- stick_max=$((stick_count - 1))
- ram_info=""
- for i in $(seq 0 $stick_max)
- do
- e=$(($i + 1))
-
- manufacturer=$(echo "$dimdecode" | grep -m $e -A 21 "Memory Device$" | grep "Manufacturer:" | tail -n 1 | cut -d ':' -f 2- | xargs)
- part_number=$(echo "$dimdecode" | grep -m $e -A 21 "Memory Device$" | grep "Part Number:" | tail -n 1 | cut -d ':' -f 2- | xargs)
- serial=$(echo "$dimdecode" | grep -m $e -A 21 "Memory Device$" | grep "Serial Number:" | tail -n 1 | cut -d ':' -f 2- | xargs)
- type=$(echo "$dimdecode" | grep -m $e -A 21 "Memory Device$" | grep "Type:" | tail -n 1 | cut -d ':' -f 2- | xargs)
- size=$(echo "$dimdecode" | grep -m $e -A 21 "Memory Device$" | grep "Size:" | tail -n 1 | cut -d ':' -f 2- | xargs)
- clock=$(echo "$dimdecode" | grep -m $e -A 21 "Memory Device$" | grep "Configured Clock Speed:" | tail -n 1 | cut -d ':' -f 2- | xargs)
- locator=$(echo "$dimdecode" | grep -m $e -A 21 "Memory Device$" | grep "Locator:" | grep -v "Bank" | tail -n 1 | cut -d ':' -f 2- | xargs)
-
- ram_info=$(echo "${ram_info}RAM_STICK,$i,$type,$manufacturer,$part_number,$serial,$size,$clock,$locator\n")
- done
-
- sed -i "s\`^EXE,\`${mobo_info}${bios_info}${cpu_info}${ram_info}EXE,\`g" $dump_file
-}
-
-function resolve_gpu_name() {
- dump_file="$1"
-
- drm_gpu=$(grep -e '^DRM,' $dump_file)
- vendor=$(echo $drm_gpu | cut -d ',' -f 8)
- devid=$(echo $drm_gpu | cut -d ',' -f 9)
-
- case "$vendor" in
- 0x8086)
- chipset=$($root_dir/scripts/intel-gpu-search-pci-id.sh "$devid")
- name=$(echo "$chipset" | cut -d , -f 2 | xargs)
- general_name=$(echo "$chipset" | cut -d , -f 3 | xargs | rev | cut -d \) -f 2- | rev)
- sed -i "s\`$drm_gpu\`$drm_gpu,$name,$general_name\`g" $dump_file
- ;;
- esac
-}
-
-# Try to load the MSR module to query MSRs
-sudo -n modprobe msr
-msr_loaded=$(test -z "$(grep ^msr /proc/modules)" ; echo $?)
-
-resolve_SHA1 "$SHA1_DB" "$dump_file"
-add_dmidecode_info "$dump_file"
-resolve_gpu_name "$dump_file"
-
-exit 0
diff --git a/utils/env_dump/env_dump_parser.py b/utils/env_dump/env_dump_parser.py
deleted file mode 100755
index 03d14a1..0000000
--- a/utils/env_dump/env_dump_parser.py
+++ /dev/null
@@ -1,229 +0,0 @@
-#!/usr/bin/env python3
-
-"""
-Copyright (c) 2015, Intel Corporation
-
-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
-"""
-
-import collections
-import re
-
-class EnvDumpReport:
- csv_layout_v1 = [
- ['BIOS', 'vendor', 'version', 'date'],
- ['BOOTLINK', 'fullpath', 'SHA1', 'provider'],
- ['CPU_FREQ', 'cpu count', 'cpu#0 min', 'cpu#0 max', 'cpu#1 min', 'cpu#1 max', 'cpu#2 min', 'cpu#2 max', 'cpu#3 min', 'cpu#3 max', 'cpu#4 min', 'cpu#4 max', 'cpu#5 min', 'cpu#5 max', 'cpu#6 min', 'cpu#6 max', 'cpu#7 min', 'cpu#7 max', 'cpu#8 min', 'cpu#8 max', 'cpu#9 min', 'cpu#9 max', 'cpu#10 min', 'cpu#10 max', 'cpu#11 min', 'cpu#11 max'],
- ['DATE', 'day', 'time', 'timezone'],
- ['DRM', 'major', 'minor', 'patchlevel', 'driver', 'description', 'vendor', 'devid'],
- ['DYNLINK', 'fullpath', 'SHA1', 'provider'],
- ['EGL_NEWCONTEXTUSED', 'vendor', 'version', 'client APIs', 'extensions'],
- ['ENV', 'key', 'value'],
- ['ENV_SET', 'key', 'value'],
- ['ENV_UNSET', 'value'],
- ['ENV_CLEAR', 'value'],
- ['EXE', 'fullpath', 'cmdline', 'SHA1', 'provider'],
- ['GL_NEWCONTEXTUSED', 'vendor', 'renderer', 'version', 'GL version', 'GLSL version', 'extension count', 'extensions'],
- ['GLX_NEWCONTEXTUSED', 'vendor', 'version', 'extensions'],
- ['INTEL_DRM', 'freq min (MHz)', 'freq max (MHz)', 'freq RP0 (MHz)', 'freq RP1 (MHz)', 'freq RPn (MHz)'],
- ['INTEL_PSTATE', 'pstate count', 'turbo pstate (%)', 'turbo disabled', 'min (%)', 'max (%)'],
- ['IOCTL', 'fullpath'],
- ['KERNEL', 'name', 'nodename', 'release', 'version', 'archicture', 'domain name'],
- ['LIBDRM', 'major', 'minor', 'patchlevel'],
- ['MOTHERBOARD', 'manufacturer', 'product name', 'version'],
- ['PROCESSOR', 'index', 'manufacturer', 'id', 'version', 'core count', 'thread count', 'L1 size', 'L2 size', 'L3 size', 'max clock', 'virtualization enabled'],
- ['RAM_STICK', 'index', 'type', 'manufacturer', 'part number', 'serial', 'size', 'actual clock', 'location'],
- ['SCHED', 'policy', 'cpu installed', 'cpu active', 'affinity', 'priority'],
- ['SOCKET_UNIX_CONNECT', 'fullpath', 'server fullpath', 'server cmdline', 'SHA1', 'provider'],
- ['THROTTLING', 'cpu count', 'package', 'cpu list', 'cpu0', 'cpu1', 'cpu2', 'cpu3', 'cpu4', 'cpu5', 'cpu6', 'cpu7', 'cpu8', 'cpu9', 'cpu10', 'cpu11'],
- ['XORG_CLOSE', 'display'],
- ['XORG_DISPLAY', 'screen id', 'compositor', 'width', 'height', 'depth'],
- ['XORG_SESSION_OPENED', 'display name'],
- ['XORG_WINDOW_CREATE', 'parent window id', 'window id', 'width', 'height', 'depth'],
- ['XORG_WINDOW_RESIZE', 'window id', 'width', 'height'],
- ]
-
- keys = [
- ['BOOTLINK', 'fullpath', '([^/]*)$'],
- ['DYNLINK', 'fullpath', '([^/]*)$'],
- ['ENV', 'key', ''],
- ['PROCESSOR', 'index', ''],
- ['RAM_STICK', 'index', ''],
- ]
-
- # format: LINE_HEADER, Key template, value template
- human_v1 = [
- ['BIOS', 'HW: BIOS', '${vendor} ${version} ${date}'],
- ['BOOTLINK', 'SW: Link (boot): ${fullpath}', '${provider}'],
- ['CPU_FREQ', 'OS: CPU governor', 'freq. ranges (kHz): [${cpu#0 min}, ${cpu#0 max}], [${cpu#1 min}, ${cpu#1 max}], [${cpu#2 min}, ${cpu#2 max}], [${cpu#3 min}, ${cpu#3 max}], [${cpu#4 min}, ${cpu#4 max}], [${cpu#5 min}, ${cpu#5 max}], [${cpu#6 min}, ${cpu#6 max}], [${cpu#7 min}, ${cpu#7 max}], [${cpu#8 min}, ${cpu#8 max}], [${cpu#9 min}, ${cpu#9 max}], [${cpu#10 min}, ${cpu#10 max}], [${cpu#11 min}, ${cpu#11 max}]'],
- ['DATE', 'OS: Date', '${day} ${time} ${timezone}'],
- ['DRM', 'SW: DRM driver', '${vendor}:${devid} : ${driver}(${major}.${minor}.${patchlevel})'],
- ['DYNLINK', 'SW: Link (dynamic): ${fullpath}', '${provider}'],
- ['EGL_NEWCONTEXTUSED', 'SW: EGL context', '${vendor}, version ${version}, APIs \'${client APIs}\', extensions: ${extensions}'],
- ['ENV', 'OS: Env (startup): ${key}', '${value}'],
- ['ENV_SET', 'OS: Env set: ${key}', '${value}'],
- ['ENV_UNSET', 'OS: Env unset: ${value}', ''],
- ['ENV_CLEAR', 'OS: Env clear', ''],
- ['EXE', 'OS: Binary cmdline (${fullpath})', '${cmdline} (${provider})'],
- ['GL_NEWCONTEXTUSED', 'SW: GL context ${version} GLSL ${GLSL version}', '${vendor}, ${renderer}, ${GL version}, extensions: ${extensions}'],
- ['GLX_NEWCONTEXTUSED', 'SW: GLX context', '${vendor}, version ${version}, extensions: ${extensions}'],
- ['INTEL_DRM', 'OS: GPU governor', 'freq. range (MHz) = [${freq min (MHz)}, ${freq max (MHz)}], RP0 = ${freq RP0 (MHz)}, RP1 = ${freq RP1 (MHz)}, RPn = ${freq RPn (MHz)}'],
- ['INTEL_PSTATE', 'OS: CPU governor pstate', 'range = [${min (%)}%, ${max (%)}%], turbo disabled? ${turbo disabled}'],
- ['IOCTL', 'HW: Device node', '${fullpath}'],
- ['KERNEL', 'OS: Kernel', '${name}, ${nodename}, ${release}, ${version}, ${achitecture}, ${domain name}'],
- ['LIBDRM', 'SW: Libdrm', 'ABI version ${major}.${minor}.${patchlevel}'],
- ['MOTHERBOARD', 'HW: Motherboard', '${manufacturer} ${product name} ${version}'],
- ['PROCESSOR', 'HW: Processor${index}', '${manufacturer} ${version} (${id}), max freq. ${max clock}, ${core count} cores ${thread count} threads, L1=${L1 size}, L2=${L2 size}, L3=${L3 size}, virt? ${virtualization enabled}'],
- ['RAM_STICK', 'HW: RAM${index}', '${type} ${size} @ ${actual clock} installed in ${location}'],
- ['SCHED', 'OS: CPU sched.', '${policy}, CPUs=(installed=${cpu installed}, active=${cpu active}), affinity=${affinity} nice=${priority}'],
- ['SOCKET_UNIX_CONNECT', 'OS: UNIX service ${fullpath}', 'exe_path=${server fullpath}, cmd=${server cmdline}, version=${provider}'],
- ['THROTTLING', 'HW: Throttling events', 'package=${package}, CPUs=[${cpu0}, ${cpu1}, ${cpu2}, ${cpu3}, ${cpu4}, ${cpu5}, ${cpu6}, ${cpu7}, ${cpu8}, ${cpu9}, ${cpu10}, ${cpu11}]'],
- ['XORG_CLOSE', 'OS: X display closed', '${display}'],
- ['XORG_DISPLAY', 'OS: X display', 'Screen id ${screen id} (${width}x${height}x${depth}) with compositor ${compositor}'],
- ['XORG_SESSION_OPENED', 'OS: X display opened', '${display name}'],
- ['XORG_WINDOW_CREATE', 'OS: X window created', '${width}x${height}x${depth}, id=${window id} (parent=${parent window id})'],
- ['XORG_WINDOW_RESIZE', 'OS: X window resized', 'id=${window id} to ${width}x${height}'],
- ]
-
- def __createkey__(self, category, vals):
- # Try to find a key
- for key in self.keys:
- if key[0] == category:
- m = re.search(key[2], vals[key[1]])
- if m is not None and len(m.groups()) > 0:
- return m.groups()[0]
- else:
- return vals[key[1]]
-
- # We failed, use a number instead
- return "{0}".format(len(self.values[category]))
-
- def __patternresolve__(self, pattern, fields):
- out = pattern
- for key in fields:
- if key == "extensions":
- value = ' '.join(str(e) for e in fields[key])
- else:
- value = fields[key]
- out = out.replace("${" + key + "}", value)
- out = re.sub('\$\{[^}]*\}', '', out)
- return out
-
- def __humanoutput__(self, category, fields):
- # look for a human entry for those fields
- for human_line in self.human_v1:
- if human_line[0] == category:
- key = self.__patternresolve__(human_line[1], fields)
- values = self.__patternresolve__(human_line[2], fields)
- if key in self.values:
- index=1
- while "{}#{}".format(key, index) in self.values:
- index = index + 1
- key = "{}#{}".format(key, index)
- self.values[key] = values
- return True
- return False
-
- def __init__(self, report_path, human=False):
- try:
- f = open(report_path)
- except Exception as e:
- print("Cannot open the file {0}: {1}".format(report_path, str(e)))
- return
-
- # Create the report
- self.version = -1
- self.complete = False
- self.values = dict()
- head_re = re.compile('^-- Env dump start \(version (\d+)\) --$')
- for line in f:
- fields = line.rstrip('\n').split(',')
-
- # Parse the header and footer
- if len(fields) == 1:
- head_m = head_re.match(fields[0])
- if head_m is not None:
- self.version = int(head_m.groups()[0])
- elif fields[0] == '-- Env dump end --':
- self.complete = True
-
- # Look for the right line in the csv layout
- for layout_line in self.csv_layout_v1:
- if layout_line[0] == fields[0]:
- # Copy each entry
- vals = dict()
- for f in range(1, len(layout_line)):
- if len(fields) > f:
- if layout_line[f] == 'extensions':
- vals[layout_line[f]] = set(fields[f].strip().split(' '))
- else:
- vals[layout_line[f]] = fields[f]
-
- # create the entry
- cat = layout_line[0]
- if human:
- self.__humanoutput__(cat, vals)
- else:
- if cat not in self.values:
- self.values[cat] = vals
- else:
- if type(self.values[cat]) is dict:
- orig = self.values[cat]
- self.values[cat] = collections.OrderedDict()
- entry_key = self.__createkey__(cat, orig)
- self.values[cat][entry_key] = orig
- entry_key = self.__createkey__(cat, vals)
- self.values[cat][entry_key] = vals
-
- def __to_set__(self, head, key, ignore_list):
- if type(head) is str:
- return set([(key, head)])
-
- out = set()
- for entry in head:
- if len(key) > 0:
- entrykey = key + "." + entry
- else:
- entrykey = entry
-
- ignore = False
- for ignoreentry in ignore_list:
- if ignoreentry.search(entrykey) is not None:
- ignore = True
- if ignore == True:
- continue
-
- if type(head) is not set:
- out.update(self.__to_set__(head[entry], entrykey, ignore_list))
- else:
- out.update(set([(entrykey, True)]))
- return out
-
- def to_set(self, ignore_list=[]):
- ignore_list_re = []
- # pre-compile the ignore_list
- for ignoreentry in ignore_list:
- ignore_list_re.append(re.compile(ignoreentry))
-
- return self.__to_set__(self.values, "", ignore_list_re)
diff --git a/utils/env_dump/fd.c b/utils/env_dump/fd.c
deleted file mode 100644
index 9fa6501..0000000
--- a/utils/env_dump/fd.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/* Copyright (c) 2015, Intel Corporation
- *
- * 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.
- */
-
-#define _GNU_SOURCE
-
-#include "env_dump.h"
-
-#include <sys/types.h>
-#include <pthread.h>
-#include <unistd.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <dlfcn.h>
-#include <link.h>
-
-/* Have a small DB of booleans that will store if we already accounted the
- * fd (1) or not yet (0). This DB can hold up to 2048, which is twice the usual
- * limit found on Linux.
- */
-static pthread_mutex_t fd_mp = PTHREAD_MUTEX_INITIALIZER;
-static unsigned long fds[64] = { 0 };
-
-/* get the possibility to call hooks when closing an fd */
-static struct fd_close_cb_t {
- fd_callback cb;
- int fd;
- void *user;
-} *fd_close_cb;
-static size_t fd_close_cb_len;
-
-static inline int
-bit_read(int bit)
-{
- int val;
-
- /* If we go out of the expected range, just give up and say it has been
- * reported already!
- */
- if (unlikely(bit > sizeof(fds) * 8))
- return 1;
-
- val = (fds[bit >> 5] >> (bit & 0x1f)) & 1;
-
- return val;
-}
-
-static inline void
-bit_write(int bit, int value)
-{
- int idxh, idxl;
-
- if (unlikely(bit > sizeof(fds) * 8))
- return;
-
- idxh = bit >> 5;
- idxl = bit & 0x1f;
- fds[idxh] = (fds[idxh] & ~(1 << idxl)) | (value << idxl);
-}
-
-static ssize_t
-get_path_from_fd(int fd, char *buf, size_t bufsiz)
-{
- /* longest fd path is /proc/4194303/fd/1024 --> 21 chars */
- char proc_path[22];
- sprintf(proc_path, "/proc/%u/fd/%u", getpid(), fd);
-
- return readlink(proc_path, buf, bufsiz);
-}
-
-int
-ioctl(int fd, unsigned long int request, ...)
-{
- int (*orig_ioctl)(int, unsigned long int, ...);
- void *arg;
- va_list ap;
-
- va_start(ap, request);
- arg = va_arg(ap, void *);
-
- /* If it is the first time we see an ioctl on this fd */
- pthread_mutex_lock(&fd_mp);
-
- orig_ioctl = _env_dump_resolve_symbol_by_id(SYMB_IOCTL);
-
- if (!bit_read(fd)) {
- char path[101];
- size_t len = get_path_from_fd(fd, path, sizeof(path));
- path[len] = '\0';
- if (path[0] == '/')
- fprintf(env_file, "IOCTL,%s\n", path);
- bit_write(fd, 1);
-
- pthread_mutex_unlock(&fd_mp);
-
- _env_dump_drm_dump_info(path, fd);
- } else
- pthread_mutex_unlock(&fd_mp);
-
- return orig_ioctl(fd, request, arg);
-}
-
-void
-_env_dump_close_callback(int fd, fd_callback cb, void *user)
-{
- int idx = -1, i;
-
- pthread_mutex_lock(&fd_mp);
- for (i = 0; i < fd_close_cb_len; i++) {
- /* re-use a slot if available */
- if (fd_close_cb[i].cb == NULL)
- idx = i;
- }
-
- if (idx < 0) {
- fd_close_cb = realloc(fd_close_cb, sizeof(struct fd_close_cb_t) * (fd_close_cb_len + 1));
- /* XXX: just crash if we do not have enough RAM ... */
- idx = fd_close_cb_len;
- fd_close_cb_len++;
- }
-
- fd_close_cb[idx].fd = fd;
- fd_close_cb[idx].cb = cb;
- fd_close_cb[idx].user = user;
-
- pthread_mutex_unlock(&fd_mp);
-}
-
-static void
-call_fd_close_callbacks(int fd)
-{
- int i;
-
- pthread_mutex_lock(&fd_mp);
-
- /* call the callbacks */
- for (i = 0; i < fd_close_cb_len; i++) {
- /* re-use a slot if available */
- if (fd < 0 || fd_close_cb[i].fd == fd) {
- fd_callback cb = fd_close_cb[i].cb;
- int cb_fd = fd_close_cb[i].fd;
- void *cb_user = fd_close_cb[i].user;
- fd_close_cb[i].fd = -1;
- fd_close_cb[i].cb = NULL;
- fd_close_cb[i].user = NULL;
- pthread_mutex_unlock(&fd_mp);
- cb(cb_fd, cb_user);
- pthread_mutex_lock(&fd_mp);
- }
- }
-
- pthread_mutex_unlock(&fd_mp);
-}
-
-int
-close(int fd)
-{
- int (*orig_close)(int);
-
- orig_close = _env_dump_resolve_symbol_by_name("close");
-
- /* call the callbacks */
- call_fd_close_callbacks(fd);
-
- pthread_mutex_lock(&fd_mp);
- bit_write(fd, 0);
- pthread_mutex_unlock(&fd_mp);
-
- return orig_close(fd);
-}
-
-void
-_env_dump_fd_init()
-{
-
-}
-
-void
-_env_dump_fd_fini()
-{
- /* call the callbacks */
- call_fd_close_callbacks(-1);
-}
diff --git a/utils/env_dump/gl.c b/utils/env_dump/gl.c
deleted file mode 100644
index b4872f5..0000000
--- a/utils/env_dump/gl.c
+++ /dev/null
@@ -1,302 +0,0 @@
-/* Copyright (c) 2015, Intel Corporation
- *
- * 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.
- */
-
-#define _GNU_SOURCE
-
-#include "env_dump.h"
-
-#include <sys/time.h>
-#include <pthread.h>
-#include <EGL/egl.h>
-#include <stdlib.h>
-#include <GL/glx.h>
-#include <stdlib.h>
-#include <string.h>
-#include <link.h>
-
-static uint64_t print_period_ms = -1;
-
-static uint64_t
-get_time_us()
-{
- struct timeval tv;
- gettimeofday(&tv, NULL);
- return tv.tv_sec * 1e6 + tv.tv_usec;
-}
-
-static float
-fps_clamp(uint64_t frametime_us)
-{
- if (frametime_us > 0)
- return 1.0e6 / ((float)frametime_us);
- else
- return 0.0;
-}
-
-void
-swap_buffer_stopwatch()
-{
- static uint64_t first_frame, last_update, last_print;
- static uint64_t min = -1, max, count;
- uint64_t cur_time = get_time_us();
-
- if (first_frame == 0)
- first_frame = cur_time;
-
- if (last_update > 0) {
- uint64_t diff = cur_time - last_update;
- count++;
- if (diff > max)
- max = diff;
- if (diff < min)
- min = diff;
- }
-
- if (last_print == 0)
- last_print = cur_time;
- else if (cur_time - last_print > print_period_ms * 1000) {
- uint64_t diff = cur_time - last_print;
- uint64_t frametime_avg = diff / count;
- fprintf(stderr, "FPS,%lu,%.3f,%.3f,%.3f\n", cur_time - first_frame,
- fps_clamp(frametime_avg), fps_clamp(max),
- fps_clamp(min));
-
- /* reset the state */
- last_print = cur_time;
- count = 0;
- min = -1;
- max = 0;
- }
-
- last_update = cur_time;
-}
-
-void
-glXSwapBuffers(Display *dpy, GLXDrawable drawable)
-{
- void (*orig_glXSwapBuffers)(Display *, GLXDrawable);
-
- orig_glXSwapBuffers = _env_dump_resolve_symbol_by_id(SYMB_GLXSWAPBUFFERS);
-
- if (print_period_ms != -1)
- swap_buffer_stopwatch();
-
- orig_glXSwapBuffers(dpy, drawable);
-}
-
-__GLXextFuncPtr glXGetProcAddressARB(const GLubyte *procName)
-{
- __GLXextFuncPtr (*orig_glXGetProcAddressARB)(const GLubyte *);
- void *external, *internal;
-
- orig_glXGetProcAddressARB = _env_dump_resolve_symbol_by_name("glXGetProcAddressARB");
-
- /* First look up the right symbol */
- external = orig_glXGetProcAddressARB(procName);
- if (!external)
- return external;
-
- /* check if we have an internal version of it! */
- internal = _env_dump_resolve_local_symbol_by_name((const char*)procName);
- if (!internal)
- return external;
-
- /* add the right symbol to the list of known symbols */
- _env_dump_replace_symbol((const char*)procName, external);
-
- /* return the internal address */
- return internal;
-}
-
-EGLBoolean
-eglSwapBuffers(EGLDisplay display, EGLSurface surface)
-{
- EGLBoolean (*orig_eglSwapBuffers)(EGLDisplay, EGLSurface);
-
- orig_eglSwapBuffers = _env_dump_resolve_symbol_by_id(SYMB_EGLSWAPBUFFERS);
-
- if (print_period_ms != -1)
- swap_buffer_stopwatch();
-
- return orig_eglSwapBuffers(display, surface);
-}
-
-static void
-dump_gl_info()
-{
- void (*orig_glGetIntegerv)(GLenum, GLint *);
- const GLubyte* (*orig_glGetString)(GLenum);
- const GLubyte* (*orig_glGetStringi)(GLenum, GLuint);
- GLint num_extension = 0, major, minor, i;
-
- /* get the pointers to the functions we will use */
- orig_glGetIntegerv = _env_dump_resolve_symbol_by_name("glGetIntegerv");
- orig_glGetString = _env_dump_resolve_symbol_by_name("glGetString");
- orig_glGetStringi = _env_dump_resolve_symbol_by_name("glGetStringi");
-
- /* exit early if the context is invalid */
- if (orig_glGetString(GL_VENDOR) == NULL)
- return;
-
- /* give informations about the context */
- orig_glGetIntegerv(GL_NUM_EXTENSIONS, &num_extension);
- orig_glGetIntegerv(GL_MAJOR_VERSION, &major);
- orig_glGetIntegerv(GL_MINOR_VERSION, &minor);
-
- fprintf(env_file, "GL_NEWCONTEXTUSED,%s,%s,%i.%i,%s,%s,%i,",
- orig_glGetString(GL_VENDOR), orig_glGetString(GL_RENDERER),
- major, minor, orig_glGetString(GL_VERSION),
- orig_glGetString(GL_SHADING_LANGUAGE_VERSION), num_extension);
-
- if (major > 3 || (major == 3 && minor >= 1)) {
- for (i = 0; i < num_extension && orig_glGetStringi; i++)
- fprintf(env_file, "%s ", orig_glGetStringi(GL_EXTENSIONS, i));
- fprintf(env_file, "\n");
- } else
- fprintf(env_file, "%s\n", glGetString(GL_EXTENSIONS));
-}
-
-Bool
-glXMakeCurrent(Display *dpy, GLXDrawable drawable, GLXContext ctx)
-{
- static pthread_mutex_t dumped_contexts_mp = PTHREAD_MUTEX_INITIALIZER;
- static size_t dumped_glxcontexts_count = 0;
- static GLXContext *dumped_glxcontexts;
-
- Bool (*orig_glXMakeCurrent)(Display *, GLXDrawable, GLXContext);
- const char *(*orig_glXGetClientString)(Display *, int);
- Bool ret = False;
- int entry_count, i;
-
- pthread_mutex_lock(&dumped_contexts_mp);
-
- orig_glXMakeCurrent = _env_dump_resolve_symbol_by_id(SYMB_GLXMAKECURRENT);
- orig_glXGetClientString = _env_dump_resolve_symbol_by_name("glXGetClientString");
-
- ret = orig_glXMakeCurrent(dpy, drawable, ctx);
- if (ret == False)
- goto done;
-
- /* check if the context is in the list */
- for(i = 0; i < dumped_glxcontexts_count; i++) {
- if (dumped_glxcontexts[i] == ctx)
- goto done;
- }
-
- /* we did not find it, add it to the list before dumping all the
- * informations. Allocate 10 contexts at a time to avoid copying every
- * time.
- */
- entry_count = (((dumped_glxcontexts_count + 1) / 10) + 1) * 10;
- dumped_glxcontexts = realloc(dumped_glxcontexts,
- entry_count * sizeof(GLXContext));
- dumped_glxcontexts[dumped_glxcontexts_count] = ctx;
- dumped_glxcontexts_count++;
-
- /* dump the egl-related informations */
- if (orig_glXGetClientString) {
- fprintf(env_file, "GLX_NEWCONTEXTUSED,%s,%s,%s\n",
- orig_glXGetClientString(dpy, GLX_VENDOR),
- orig_glXGetClientString(dpy, GLX_VERSION),
- orig_glXGetClientString(dpy, GLX_EXTENSIONS));
- }
-
- dump_gl_info();
-
-done:
- pthread_mutex_unlock(&dumped_contexts_mp);
- return ret;
-}
-
-EGLBoolean
-eglMakeCurrent(EGLDisplay display, EGLSurface draw, EGLSurface read,
- EGLContext context)
-{
- static pthread_mutex_t dumped_contexts_mp = PTHREAD_MUTEX_INITIALIZER;
- static size_t dumped_eglcontexts_count = 0;
- static EGLContext *dumped_eglcontexts;
- EGLBoolean (*orig_eglMakeCurrent)(Display *, EGLSurface,
- EGLSurface, EGLContext);
- char const *(*orig_eglQueryString)(EGLDisplay, EGLint);
- EGLBoolean ret = False;
- EGLenum api;
- int entry_count, i;
-
- pthread_mutex_lock(&dumped_contexts_mp);
-
- orig_eglMakeCurrent = _env_dump_resolve_symbol_by_id(SYMB_EGLMAKECURRENT);
- orig_eglQueryString = _env_dump_resolve_symbol_by_name("eglQueryString");
-
- ret = orig_eglMakeCurrent(display, draw, read, context);
- if (ret == False)
- goto done;
-
- /* check if the context is in the list */
- for(i = 0; i < dumped_eglcontexts_count; i++) {
- if (dumped_eglcontexts[i] == context)
- goto done;
- }
-
- /* we did not find it, add it to the list before dumping all the
- * informations. Allocate 10 contexts at a time to avoid copying every
- * time.
- */
- entry_count = (((dumped_eglcontexts_count + 1) / 10) + 1) * 10;
- dumped_eglcontexts = realloc(dumped_eglcontexts,
- entry_count * sizeof(EGLContext));
- dumped_eglcontexts[dumped_eglcontexts_count] = context;
- dumped_eglcontexts_count++;
-
- /* dump the egl-related informations */
- fprintf(env_file, "EGL_NEWCONTEXTUSED,%s,%s,%s,%s\n",
- orig_eglQueryString(display, EGL_VENDOR),
- orig_eglQueryString(display, EGL_VERSION),
- orig_eglQueryString(display, EGL_CLIENT_APIS),
- orig_eglQueryString(display, EGL_EXTENSIONS));
-
- /* dump the gl-related informations */
- api = eglQueryAPI();
- if (api == EGL_OPENGL_API || api == EGL_OPENGL_ES_API)
- dump_gl_info();
-
-done:
- pthread_mutex_unlock(&dumped_contexts_mp);
- return ret;
-}
-
-void
-_env_dump_gl_init()
-{
- const char *frametime_period = getenv("ENV_DUMP_FPS_PRINT_PERIOD_MS");
- if (frametime_period != NULL)
- print_period_ms = strtoll(frametime_period, NULL, 10);
-}
-
-void
-_env_dump_gl_fini()
-{
-
-} \ No newline at end of file
diff --git a/utils/env_dump/libs.c b/utils/env_dump/libs.c
deleted file mode 100644
index 92025d7..0000000
--- a/utils/env_dump/libs.c
+++ /dev/null
@@ -1,451 +0,0 @@
-/* Copyright (c) 2015, Intel Corporation
- *
- * 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.
- */
-
-#define _GNU_SOURCE
-
-#include "env_dump.h"
-
-#include <openssl/sha.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <pthread.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <link.h>
-
-static pthread_mutex_t found_so_list_mp = PTHREAD_MUTEX_INITIALIZER;
-size_t shared_object_count = 0;
-struct shared_object {
- char *full_path;
- /* more here? */
-} *found_so_list = NULL;
-
-void *handle_libcrypto = NULL;
-unsigned char *(*SHA1_local)(const unsigned char *d, size_t n, unsigned char *md);
-
-
-struct fll_data {
- const char *name;
- size_t len_name;
- char *ret;
-};
-
-static int
-find_Linked_library_callback(struct dl_phdr_info *info, size_t size, void *data)
-{
- struct fll_data *p = (struct fll_data *) data;
- size_t len = strlen(info->dlpi_name);
- size_t offset = len - p->len_name;
-
- if (len < p->len_name)
- return 0;
-
- if (strcmp(info->dlpi_name + offset, p->name) == 0) {
- p->ret = strdup(info->dlpi_name);
- return 1;
- }
-
- return 0;
-}
-
-static char *
-find_Linked_library(const char *name)
-{
- struct fll_data data = {name, strlen(name), NULL};
-
- dl_iterate_phdr(find_Linked_library_callback, &data);
-
- return data.ret;
-}
-
-static int
-libcrypto_resolve_symbols()
-{
- void *(*orig_dlopen)(const char *, int);
-
- if (handle_libcrypto == NULL) {
- orig_dlopen = _env_dump_resolve_symbol_by_name("dlopen");
-
- /* Open a local version of the libcrypto */
- handle_libcrypto = orig_dlopen("libcrypto.so",
- RTLD_LOCAL | RTLD_LAZY);
- if (handle_libcrypto)
- SHA1_local = dlsym(handle_libcrypto, "SHA1");
- }
-
- return !handle_libcrypto && !SHA1_local;
-}
-
-void
-_env_dump_compute_and_print_sha1(const char *full_path)
-{
- unsigned char hash[SHA_DIGEST_LENGTH];
- unsigned char *data;
- off_t size;
- int fd, i;
-
- /* this function can be called before init(), so let's check if the
- * libcrypto has been loaded or not yet.
- */
- if (libcrypto_resolve_symbols()) {
- fprintf(env_file, "ERR_MISSING_LIBCRYPTO");
- } else {
- fd = open(full_path, O_RDONLY);
- size = lseek(fd, 0, SEEK_END);
- data = mmap (0, size, PROT_READ, MAP_PRIVATE, fd, 0);
- if (data == MAP_FAILED) {
- fprintf(env_file, "UNK");
- return;
- }
-
- SHA1_local(data, size, hash);
-
- for (i = 0; i < 20; i++) {
- fprintf(env_file, "%02x", hash[i]);
- }
-
- munmap(data, size);
- close(fd);
- }
-}
-
-static int
-add_so_to_found_list(const char *full_path, const char *when)
-{
- int ret = 0, i;
-
- pthread_mutex_lock(&found_so_list_mp);
- found_so_list = realloc(found_so_list,
- sizeof(struct shared_object) * (shared_object_count + 1));
- if (found_so_list) {
- /* look for already-existing entries */
- for (i = 0; i < shared_object_count; i++) {
- if (strcmp(found_so_list[i].full_path, full_path) == 0) {
- ret = -1;
- goto done;
- }
- }
-
- /* we could not find an already-existing entry, add a new one */
- found_so_list[shared_object_count].full_path = strdup(full_path);
- shared_object_count++;
-
- /* report the finding */
- fprintf(env_file, "%s,%s,", when, full_path);
- _env_dump_compute_and_print_sha1(full_path);
- fprintf(env_file, "\n");
- } else
- fprintf(env_file, "ERROR,add_so_to_found_list,realloc\n");
-
-done:
- pthread_mutex_unlock(&found_so_list_mp);
- return ret;
-}
-
-static int
-ldd_callback(struct dl_phdr_info *info, size_t size, void *data)
-{
- if (strlen(info->dlpi_name) == 0)
- return 0;
-
- add_so_to_found_list(info->dlpi_name, "BOOTLINK");
-
- return 0;
-}
-
-static int
-new_deps_callback(struct dl_phdr_info *info, size_t size, void *data)
-{
- if (strlen(info->dlpi_name) == 0)
- return 0;
-
- add_so_to_found_list(info->dlpi_name, "DYNLINK");
-
- return 0;
-}
-
-static void
-_dlopen_check_result(void *handle, const char *filename, int flag)
-{
- char *full_path;
- struct link_map *lm;
-
- if (!handle || !filename)
- return;
-
- dlinfo(handle, RTLD_DI_LINKMAP, &lm);
- full_path = realpath(lm->l_name, NULL);
-
- add_so_to_found_list(full_path, "DYNLINK");
-
- free(full_path);
-
- /* check if we pulled-in more deps */
- dl_iterate_phdr(new_deps_callback, NULL);
-}
-
-void *
-dlopen(const char *filename, int flags)
-{
- void *(*orig_dlopen)(const char *, int);
- void *handle = NULL;
-
- orig_dlopen = _env_dump_resolve_symbol_by_name("dlopen");
-
- handle = orig_dlopen(filename, flags);
- _dlopen_check_result(handle, filename, flags);
-
- return handle;
-}
-
-void *
-dlmopen(Lmid_t lmid, const char *filename, int flags)
-{
- void *(*orig_dlmopen)(Lmid_t, const char *, int);
- void *handle;
-
- orig_dlmopen = _env_dump_resolve_symbol_by_name("dlmopen");
-
- handle = orig_dlmopen(lmid, filename, flags);
- _dlopen_check_result(handle, filename, flags);
-
- return handle;
-}
-
-static pthread_mutex_t symbols_mp = PTHREAD_MUTEX_INITIALIZER;
-size_t symbols_count = 0;
-size_t symbols_len = 0;
-struct symbol_t {
- const char *name;
- void *ptr;
-} *symbols;
-
-const char *symbol_key_str[SYMB_END] = {
- "ioctl",
- "glXSwapBuffers",
- "eglSwapBuffers",
- "glXMakeCurrent",
- "eglMakeCurrent",
-};
-
-extern void *_dl_sym(void *, const char *, void *);
-void *
-_env_dump_resolve_symbol_by_name(const char *symbol)
-{
- void *ret = NULL;
- int i;
-
- pthread_mutex_lock(&symbols_mp);
-
- /* first check in our internal DB */
- for (i = 0; i < symbols_count; i++) {
- if (symbols[i].name && strcmp(symbols[i].name, symbol) == 0) {
- ret = symbols[i].ptr;
- break;
- }
- }
-
- pthread_mutex_unlock(&symbols_mp);
-
- /* Then try to see if there is another version somewhere else */
- if (ret == NULL)
- ret = _dl_sym(RTLD_NEXT, symbol, _env_dump_resolve_symbol_by_name);
-
- return ret;
-}
-
-void *
-_env_dump_resolve_symbol_by_id(enum symbol_key_t symbol)
-{
- void *ret = NULL;
-
- pthread_mutex_lock(&symbols_mp);
- if (symbol < SYMB_END && symbols_len > symbol && symbols[symbol].name)
- ret = symbols[symbol].ptr;
- pthread_mutex_unlock(&symbols_mp);
-
- /* Then try to see if there is another version somewhere else */
- if (ret == NULL) {
- ret = _dl_sym(RTLD_NEXT, symbol_key_str[symbol], _env_dump_resolve_symbol_by_name);
- _env_dump_replace_symbol(symbol_key_str[symbol], ret);
- }
-
- return ret;
-}
-
-void
-_env_dump_replace_symbol(const char *symbol, void *ptr)
-{
- int size, offset = -1, i;
-
- pthread_mutex_lock(&symbols_mp);
-
- /* first check if the symbol is known */
- for (i = 0; i < SYMB_END; i++) {
- if (strcmp(symbol_key_str[i], symbol) == 0) {
- offset = i;
- goto write_offset;
- }
- }
-
- /* check if the symbol is already in the list */
- for (i = SYMB_END; i < symbols_count; i++) {
- if (strcmp(symbols[i].name, symbol) == 0) {
- offset = i;
- goto write_offset;
- }
- }
-
- /* we need to add the symbol, compute its offset */
- offset = (symbols_count < SYMB_END) ? SYMB_END : symbols_count;
-
-write_offset:
- /* make sure we have enough space allocated */
- if (offset >= symbols_len) {
- void *prev = symbols;
- size_t start, len;
- int bs = 100;
-
- if (symbols_len == 0)
- size = SYMB_END + bs;
- else
- size = symbols_len + bs;
-
- symbols = realloc(symbols, size * sizeof(struct symbol_t));
- symbols_len = size;
-
- if (!prev) {
- start = 0;
- len = size;
- } else {
- start = size - bs;
- len = bs;
- }
-
- memset(symbols + start, '\0', len * sizeof(struct symbol_t));
-
- }
-
- /* if we are not merely updating an entry */
- if (!symbols[offset].name)
- symbols[offset].name = strdup(symbol);
- symbols[offset].ptr = ptr;
-
- /* increase the symbol count after adding an entry */
- if (offset >= symbols_count)
- symbols_count = offset + 1;
-
- pthread_mutex_unlock(&symbols_mp);
-}
-
-void *
-_env_dump_resolve_local_symbol_by_name(const char *symbol)
-{
- static void *(*orig_dlsym)(void *, const char *);
- static void *handle_env_dump;
-
- if (orig_dlsym == NULL)
- orig_dlsym = _dl_sym(RTLD_NEXT, "dlsym", dlsym);
-
- if (handle_env_dump == NULL ) {
- void *(*orig_dlopen)(const char *, int);
- char *fullpath = find_Linked_library("env_dump.so");
- orig_dlopen = _dl_sym(RTLD_NEXT, "dlopen", dlsym);
- handle_env_dump = orig_dlopen(fullpath, RTLD_LAZY);
- free(fullpath);
- }
-
- return orig_dlsym(handle_env_dump, symbol);
-}
-
-/* check which symbols the program looks up */
-void *
-dlsym(void *handle, const char *symbol)
-{
- static void *(*orig_dlsym)(void *, const char *);
- void *orig_ptr, *ptr;
-
- if (orig_dlsym == NULL)
- orig_dlsym = _dl_sym(RTLD_NEXT, "dlsym", dlsym);
-
- /* try to resolve the symbol to an internal one first to avoid issues
- * with dlerror().
- */
- ptr = _env_dump_resolve_local_symbol_by_name(symbol);
-
- /* resolve the symbol as expected by the client */
- orig_ptr = orig_dlsym(handle, symbol);
- if (!orig_ptr)
- return orig_ptr;
-
- /* add the symbol to our DB */
- _env_dump_replace_symbol(symbol, orig_ptr);
-
- if (ptr)
- return ptr;
- else
- return orig_ptr;
-}
-
-/*int dlclose(void *handle)
-{
- int(*orig_dlclose)(void *);
- orig_dlclose = _env_dump_resolve_symbol_by_name("dlclose");
-
- return orig_dlclose(handle);
-}*/
-
-void
-_env_dump_libs_init()
-{
- /* Show what we are currently linking against */
- dl_iterate_phdr(ldd_callback, NULL);
-}
-
-void
-_env_dump_libs_fini()
-{
- size_t i;
-
- /* free the memory we do not need anymore */
- pthread_mutex_lock(&found_so_list_mp);
- for (i = 0; i < shared_object_count; i++)
- free(found_so_list[i].full_path);
- shared_object_count = 0;
- free(found_so_list);
- pthread_mutex_unlock(&found_so_list_mp);
-
- /* free the symbols */
- pthread_mutex_lock(&symbols_mp);
- symbols_count = 0;
- free(symbols);
- pthread_mutex_unlock(&symbols_mp);
-
- if (handle_libcrypto)
- dlclose(handle_libcrypto);
-}
diff --git a/utils/env_dump/linux.c b/utils/env_dump/linux.c
deleted file mode 100644
index 224ee01..0000000
--- a/utils/env_dump/linux.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright (c) 2015, Intel Corporation
- *
- * 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.
- */
-
-#define _GNU_SOURCE
-
-#include "env_dump.h"
-
-#include <sys/utsname.h>
-
-void
-_env_dump_linux_init()
-{
- struct utsname buf;
-
- if (!uname(&buf)) {
- fprintf(env_file, "KERNEL,%s,%s,%s,%s,%s,%s\n", buf.sysname,
- buf.nodename, buf.release, buf.version, buf.machine,
- buf.domainname);
- }
-}
-
-void
-_env_dump_linux_fini()
-{
-
-} \ No newline at end of file
diff --git a/utils/env_dump/net.c b/utils/env_dump/net.c
deleted file mode 100644
index 0599a05..0000000
--- a/utils/env_dump/net.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Copyright (c) 2015, Intel Corporation
- *
- * 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.
- */
-
-#define _GNU_SOURCE
-
-#include "env_dump.h"
-
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/un.h>
-#include <errno.h>
-#include <link.h>
-
-int
-connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen)
-{
- int(*orig_connect)(int, const struct sockaddr *, socklen_t);
- struct sockaddr_un *addr_unix;
- socklen_t len;
- int ret;
-
- orig_connect = _env_dump_resolve_symbol_by_name("connect");
-
- ret = orig_connect(sockfd, addr, addrlen);
- if (!ret && addr->sa_family == AF_UNIX) {
- struct ucred ucred;
- const char *filepath = NULL;
-
- addr_unix = (struct sockaddr_un *)addr;
- filepath = addr_unix->sun_path;
- if (filepath[0] == '\0')
- filepath++;
-
- len = sizeof(struct ucred);
- if(getsockopt(sockfd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) < 0){
- fprintf(env_file, "SOCKET_UNIX_CONNECT,%s,,%s\n", filepath, strerror(errno));
- return ret;
- }
-
- /* display a lot more information about the process! */
- fprintf(env_file, "SOCKET_UNIX_CONNECT,%s,", filepath);
- env_var_dump_binary_information(ucred.pid);
- fprintf(env_file, "\n");
- }
-
- return ret;
-}
-
-void _env_dump_net_init()
-{
-
-}
-
-void _env_dump_net_fini()
-{
-
-}
diff --git a/utils/env_dump/posix_env.c b/utils/env_dump/posix_env.c
deleted file mode 100644
index c2633c8..0000000
--- a/utils/env_dump/posix_env.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/* Copyright (c) 2015, Intel Corporation
- *
- * 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.
- */
-
-#define _GNU_SOURCE
-
-#include "env_dump.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <link.h>
-
-void
-env_var_dump_binary_information(int pid)
-{
- size_t buflen = 4096, size;
- char *buf = malloc(buflen), *cur;
- char proc_path[22]; /* longest fd path is /proc/4194303/cmdline */
- FILE *cmd_file;
-
- if (!buf) {
- fprintf(stderr, "Error, no memory left. Exit!");
- exit(1);
- }
-
- if (pid == 0)
- pid = getpid();
-
- /* first read the url of the program */
- snprintf(proc_path, sizeof(proc_path), "/proc/%i/exe", pid);
- size = readlink(proc_path, buf, buflen);
- if (size == -1) {
- fprintf(env_file, "ERROR(%s),", strerror(errno));
- } else {
- buf[size] = '\0';
- fprintf(env_file, "%s,", buf);
- }
-
- /* then read the arguments */
- snprintf(proc_path, sizeof(proc_path), "/proc/%i/cmdline", pid);
- cmd_file = fopen(proc_path, "r");
- if (cmd_file) {
- size = fread(buf, 1, buflen, cmd_file);
-
- /* the fields are separated by \0 characters, replace them by
- * spaces and add '' arounds them. The last field has two null
- * characters.
- */
- cur = buf;
- while (*cur && (cur - buf) < size) {
- if (cur == buf)
- fprintf(env_file, "'");
- else if (*(cur - 1) == '\0')
- fprintf(env_file, " '");
- fprintf(env_file, "%c", *cur);
-
- cur++;
-
- if (*cur == '\0') {
- fprintf(env_file, "'");
- cur++;
- }
- }
- fprintf(env_file, ",");
-
- } else
- fprintf(env_file, "ERROR,");
-
- snprintf(proc_path, sizeof(proc_path), "/proc/%i/exe", pid);
- _env_dump_compute_and_print_sha1(proc_path);
-
- free(buf);
-}
-
-static void
-dump_env_var(const char *header, const char *string)
-{
- char *key, *val, *pos = strstr(string, "=");
- if (pos) {
- key = strndup(string, pos - string);
- val = strdup(pos + 1);
- fprintf(env_file, "%s,%s,%s\n", header, key, val);
- free(key); free(val);
- } else
- fprintf(env_file, "%s,%s,\n", header, string);
-}
-
-static void
-dump_env_vars()
-{
- char **env = environ;
-
- while (*env) {
- dump_env_var("ENV", *env);
- env++;
- }
-}
-
-int
-putenv(char *string)
-{
- int(*orig_putenv)(char *);
- int ret;
-
- orig_putenv = _env_dump_resolve_symbol_by_name("putenv");
-
- ret = orig_putenv(string);
- if (!ret)
- dump_env_var("ENV_SET", string);
-
- return ret;
-}
-
-int
-setenv(const char *name, const char *value, int replace)
-{
- int(*orig_setenv)(const char *, const char *, int);
- char *orig_value = NULL;
- int ret;
-
- orig_setenv = _env_dump_resolve_symbol_by_name("setenv");
-
- if (!replace)
- orig_value = getenv(name);
-
- ret = orig_setenv(name, value, replace);
- if (!ret && !(!replace && orig_value)) // do not print the message if nothing changed
- fprintf(env_file, "ENV_SET,%s,%s\n", name, value);
-
- return ret;
-}
-
-int
-unsetenv(const char *name)
-{
- int(*orig_unsetenv)(const char *);
- int ret;
-
- orig_unsetenv = _env_dump_resolve_symbol_by_name("unsetenv");
-
- ret = orig_unsetenv(name);
- if (!ret)
- fprintf(env_file, "ENV_UNSET,%s\n", name);
-
- return ret;
-}
-
-int
-clearenv(void)
-{
- int(*orig_clearenv)(void);
- int ret;
-
- orig_clearenv = _env_dump_resolve_symbol_by_name("clearenv");
-
- ret = orig_clearenv();
- if (!ret)
- fprintf(env_file, "ENV_CLEAR\n");
-
- return ret;
-}
-
-void
-_env_dump_posix_env_init()
-{
- fprintf(env_file, "EXE,");
- env_var_dump_binary_information(0);
- fprintf(env_file, "\n");
-
- dump_env_vars();
-}
-
-void
-_env_dump_posix_env_fini()
-{
-
-}
diff --git a/utils/env_dump/scripts/intel-gpu-search-pci-id.sh b/utils/env_dump/scripts/intel-gpu-search-pci-id.sh
deleted file mode 100755
index ce67e2f..0000000
--- a/utils/env_dump/scripts/intel-gpu-search-pci-id.sh
+++ /dev/null
@@ -1,169 +0,0 @@
-#!/bin/sh
-
-# Copyright 2015 Intel Corporation
-# 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 the copyright holders nor the names of their 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
-# HOLDER 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.
-
-set -eu
-
-: ${XDG_CACHE_HOME:=$HOME/.cache}
-
-prog_name=${0##*/}
-cache_dir="$XDG_CACHE_HOME/intel-gpu-info"
-cached_i965_pci_ids_h="$cache_dir/i965_pci_ids.h"
-dri_dev="/sys/class/drm/card0/device/device"
-
-
-print_help ()
-{
-cat <<EOF
-USAGE
- $prog_name [-u|--update] [--] [regex]
-
-DESCRIPTION
- Print info about all Intel GPU's whose name or pci_id match the regex. If
- no regex is given, then print info on the current machine's Intel GPU.
-
-OPTIONS
- -u, --update
- Update the cached copy of i965_pci_ids.h.
-
-EXAMPLES
- Query the local device.
- $ $prog_name
-
- Search for a specific PCI id.
- $ $prog_name 0x1616
-
- Search for all Broadwell GPUs.
- $ $prog_name broadwell
-
- Search for all GT3 GPUs.
- $ $prog_name gt3
-
- Search for an Intel GPU by its marketing name.
- $ $prog_name "Iris Pro 6200"
-EOF
-}
-
-
-parse_args ()
-{
- arg_regex=
- arg_update=
-
- for argnum in $(seq $#); do
- case "$1" in
- --)
- shift
- break
- ;;
- -h|--help)
- print_help
- exit 0
- ;;
- -u|--update)
- arg_update=1
- shift
- ;;
- -*)
- usage_error "unknown option $1"
- ;;
- *)
- break
- ;;
- esac
- done
-
- if [ $# -gt 0 ]; then
- arg_regex="$1"
- shift
- fi
-
- if [ $# -gt 0 ]; then
- usage_error "trailing args: $@"
- fi
-}
-
-usage_error ()
-{
- echo >&2 "$prog_name: usage error: $@"
- exit 2
-}
-
-die ()
-{
- echo >&2 "$prog_name: error: $@"
- exit 2
-}
-
-update_cache ()
-{
- local src
- local dst
- mkdir -p "$cache_dir"
-
- if [ -r "$cached_i965_pci_ids_h" ] && [ -z "$arg_update" ]; then
- return
- fi
-
- src="http://cgit.freedesktop.org/mesa/mesa/tree/include/pci_ids/i965_pci_ids.h"
- dst="$cached_i965_pci_ids_h"
-
- if [ -z "$(which curl)" ]; then
- if [ -z "$(which wget)" ]; then
- die "please install either 'curl' or 'wget' to fetch/update the PCI ID information"
- fi
- wget -O - "$src" > "${dst}.bak"
- else
- curl -s "$src" > "${dst}.bak"
- fi
- sed -n 's/.*CHIPSET(\(.*\))$/\1/p' < "${dst}.bak" > "$dst"
- rm "${dst}.bak"
-}
-
-main ()
-{
- local regex
-
- parse_args "$@"
-
- if [ "$arg_regex" ]; then
- regex="$arg_regex"
- elif ! regex="$(cat $dri_dev)"; then
- die "failed to read $dri_dev"
- fi
-
- update_cache
-
- grep -i -E "$regex" "$cached_i965_pci_ids_h"
- if [ $? -ne 0 ]; then
- die "failed to find '$regex' in i965_pci_ids.h"
- fi
-}
-
-main "$@"
diff --git a/utils/env_dump/xorg.c b/utils/env_dump/xorg.c
deleted file mode 100644
index 89aad5d..0000000
--- a/utils/env_dump/xorg.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/* Copyright (c) 2015, Intel Corporation
- *
- * 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.
- */
-
-#define _GNU_SOURCE
-
-#include "env_dump.h"
-
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <X11/extensions/Xrandr.h>
-#include <stdlib.h>
-#include <string.h>
-#include <link.h>
-
-/* XLib functions, should only be called if the libxcb or libX11 is loaded */
-static char *
-_env_dump_xlib_compositor(Display *dpy, int screen)
-{
- Atom wmCheckAtom, wmName,stringType, typeRet;
- unsigned long nitems, after;
- unsigned char *name = 0;
- Window root, *wm_window;
- char *result = NULL;
- int format;
-
- /* Retrieve the pointers to x-related functions */
- Atom (*orig_xinternatom)(Display *, char *, Bool);
- int (*orig_xgetwindowproperty)(Display *, Window, Atom, long, long, Bool,
- Atom, Atom *, int *, unsigned long *,
- unsigned long *, unsigned char **);
- int (*orig_xfree)(void *);
- orig_xinternatom = _env_dump_resolve_symbol_by_name("XInternAtom");
- orig_xgetwindowproperty = _env_dump_resolve_symbol_by_name("XGetWindowProperty");
- orig_xfree = _env_dump_resolve_symbol_by_name("XFree");
-
- wmCheckAtom = orig_xinternatom(dpy, "_NET_SUPPORTING_WM_CHECK", True);
- wmName = orig_xinternatom(dpy, "_NET_WM_NAME", True);
- stringType = orig_xinternatom(dpy, "UTF8_STRING", True);
-
- if (wmCheckAtom == None || wmName == None || stringType == None)
- return strdup("UNKOWN");
-
- root = RootWindow(dpy, screen);
- if (!(orig_xgetwindowproperty(dpy, root, wmCheckAtom, 0, 1024, False,
- XA_WINDOW, &typeRet, &format, &nitems, &after,
- (unsigned char **) &wm_window)))
- {
- if (wm_window && !(orig_xgetwindowproperty(dpy, *wm_window,
- wmName, 0, 1024, False, stringType, &typeRet, &format,
- &nitems, &after, (unsigned char **) &name)))
- {
- result = strdup((char *)name);
- orig_xfree(name);
- }
- }
-
- return result;
-}
-
-Display *
-XOpenDisplay(const char *display_name)
-{
- Display *(*orig_xopendisplay)(const char *);
- Display *dpy;
- int i;
-
- orig_xopendisplay = _env_dump_resolve_symbol_by_name("XOpenDisplay");
- dpy = orig_xopendisplay(display_name);
- if (dpy) {
- fprintf(env_file, "XORG_SESSION_OPENED,%s\n", display_name);
- for (i = 0; i < ScreenCount(dpy); i++) {
- char *wm = _env_dump_xlib_compositor(dpy, i);
-
- fprintf(env_file, "XORG_DISPLAY,%i,%s,%i,%i,%i\n", i,
- wm, DisplayWidth(dpy, i), DisplayHeight(dpy, i),
- DefaultDepth(dpy, i));
-
- free(wm);
- }
- }
-
- return dpy;
-}
-
-int
-XCloseDisplay(Display *display)
-{
- int (*orig_xclosedisplay)(Display *);
- int ret;
-
- orig_xclosedisplay = _env_dump_resolve_symbol_by_name("XCloseDisplay");
-
- fprintf(env_file, "XORG_CLOSE,%s\n", DisplayString(display));
- ret = orig_xclosedisplay(display);
-
- return ret;
-}
-
-Window
-XCreateSimpleWindow(Display* display, Window parent, int x, int y,
- unsigned int width, unsigned int height,
- unsigned int border_width, unsigned long border,
- unsigned long background)
-{
- int (*orig_xcreatesimplewindow)(Display *, Window, int, int,
- unsigned int, unsigned int,
- unsigned int, unsigned long,
- unsigned long);
- Window ret;
-
- orig_xcreatesimplewindow = _env_dump_resolve_symbol_by_name("XCreateSimpleWindow");
-
- ret = orig_xcreatesimplewindow(display, parent, x, y, width, height,
- border_width, border, background);
- fprintf(env_file, "XORG_WINDOW_CREATE,%lu,%lu,%i,%i,-1\n", parent, ret,
- width, height);
-
- return ret;
-}
-
-Window
-XCreateWindow(Display* display, Window parent, int x, int y,
- unsigned int width, unsigned int height,
- unsigned int border_width, int depth, unsigned int class,
- Visual* visual, unsigned long valuemask,
- XSetWindowAttributes *attributes)
-{
- int (*orig_xcreatewindow)(Display *, Window, int, int,
- unsigned int, unsigned int,
- unsigned int, int, unsigned int,
- Visual *, unsigned long,
- XSetWindowAttributes *);
- Window ret;
-
- orig_xcreatewindow = _env_dump_resolve_symbol_by_name("XCreateWindow");
-
- ret = orig_xcreatewindow(display, parent, x, y, width, height,
- border_width, depth, class, visual,
- valuemask, attributes);
- fprintf(env_file, "XORG_WINDOW_CREATE,%lu,%lu,%i,%i,%i\n", parent, ret,
- width, height, depth);
-
- return ret;
-}
-
-int
-XMoveResizeWindow(Display *display, Window w, int x, int y, unsigned int width,
- unsigned int height)
-{
- int (*orig_xmoveresizewindow)(Display *, Window, int, int,
- unsigned int, unsigned int);
- int ret;
-
- orig_xmoveresizewindow = _env_dump_resolve_symbol_by_name("XMoveResizeWindow");
-
- ret = orig_xmoveresizewindow(display, w, x, y, width, height);
- fprintf(env_file, "XORG_WINDOW_RESIZE,%lu,%i,%i\n", w, width, height);
-
- return ret;
-}
-
-int
-XResizeWindow(Display *display, Window w, unsigned int width, unsigned int height)
-{
- int (*orig_xresizewindow)(Display *, Window, unsigned int,
- unsigned int);
- int ret;
-
- orig_xresizewindow = _env_dump_resolve_symbol_by_name("XResizeWindow");
-
- ret = orig_xresizewindow(display, w, width, height);
- fprintf(env_file, "XORG_WINDOW_RESIZE,%lu,%i,%i\n", w, width, height);
-
- return ret;
-}
-
-
-/* libxcb */
-
-/* WARNING: No need to hook the connect close and createwindow functions because
- * the libxcb calls the original xlib functions which are already hook!
- */