Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix long options segmentation fault. Add version information option. #11

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 25 additions & 16 deletions GUI/Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
#############################################################################
# Makefile for building: i7z_GUI
# Generated by qmake (2.01a) (Qt 4.8.4) on: Fri Sep 13 10:41:57 2013
# Generated by qmake (2.01a) (Qt 4.8.7) on: Sun Jun 28 23:49:28 2015
# Project: i7z_GUI.pro
# Template: app
# Command: /usr/lib/x86_64-linux-gnu/qt4/bin/qmake -o Makefile i7z_GUI.pro
# Command: /usr/lib64/qt4/bin/qmake -o Makefile i7z_GUI.pro
#############################################################################

####### Compiler, tools and options

CC = gcc
CXX = g++
DEFINES = -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -m64 -pipe -v -fno-schedule-insns2 -fno-schedule-insns -fno-inline-small-functions -fno-caller-saves -g -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -m64 -pipe -v -fno-schedule-insns2 -fno-schedule-insns -fno-inline-small-functions -fno-caller-saves -g -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I.
DEFINES = -DVERSION -DAUTHOR -DMESSAGE -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -pipe -v -fno-schedule-insns2 -fno-schedule-insns -fno-inline-small-functions -fno-caller-saves -g -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -v -fno-schedule-insns2 -fno-schedule-insns -fno-inline-small-functions -fno-caller-saves -g -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I.
LINK = g++
LFLAGS = -m64
LIBS = $(SUBLIBS) -L/usr/lib/x86_64-linux-gnu -lQtGui -lQtCore -lpthread
LFLAGS =
LIBS = $(SUBLIBS) -L/usr/lib64/qt4 -lQtGui -L/usr/lib64/qt4 -lQtCore -lpthread
AR = ar cqs
RANLIB =
QMAKE = /usr/lib/x86_64-linux-gnu/qt4/bin/qmake
QMAKE = /usr/lib64/qt4/bin/qmake
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
Expand Down Expand Up @@ -52,12 +52,15 @@ DIST = /usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/g++-base.conf \
/usr/share/qt4/mkspecs/common/g++-unix.conf \
/usr/share/qt4/mkspecs/qconfig.pri \
/usr/share/qt4/mkspecs/modules/qt_phonon.pri \
/usr/share/qt4/mkspecs/modules/qt_webkit_version.pri \
/usr/share/qt4/mkspecs/features/qt_functions.prf \
/usr/share/qt4/mkspecs/features/qt_config.prf \
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
/usr/share/qt4/mkspecs/features/default_pre.prf \
/usr/share/qt4/mkspecs/features/debug.prf \
/usr/share/qt4/mkspecs/features/default_post.prf \
/usr/share/qt4/mkspecs/features/shared.prf \
/usr/share/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
/usr/share/qt4/mkspecs/features/warn_on.prf \
/usr/share/qt4/mkspecs/features/qt.prf \
Expand Down Expand Up @@ -99,21 +102,24 @@ all: Makefile $(TARGET)

$(TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
{ test -n "$(DESTDIR)" && DESTDIR="$(DESTDIR)" || DESTDIR=.; } && test $$(gdb --version | sed -e 's,[^0-9]\+\([0-9]\)\.\([0-9]\).*,\1\2,;q') -gt 72 && gdb --nx --batch --quiet -ex 'set confirm off' -ex "save gdb-index $$DESTDIR" -ex quit '$(TARGET)' && test -f $(TARGET).gdb-index && objcopy --add-section '.gdb_index=$(TARGET).gdb-index' --set-section-flags '.gdb_index=readonly' '$(TARGET)' '$(TARGET)' && rm -f $(TARGET).gdb-index || true
{ test -n "$(DESTDIR)" && DESTDIR="$(DESTDIR)" || DESTDIR=.; } && test $$(gdb --version | sed -e 's,[^0-9][^0-9]*\([0-9]\)\.\([0-9]\).*,\1\2,;q') -gt 72 && gdb --nx --batch --quiet -ex 'set confirm off' -ex "save gdb-index $$DESTDIR" -ex quit '$(TARGET)' && test -f $(TARGET).gdb-index && objcopy --add-section '.gdb_index=$(TARGET).gdb-index' --set-section-flags '.gdb_index=readonly' '$(TARGET)' '$(TARGET)' && rm -f $(TARGET).gdb-index || true

Makefile: i7z_GUI.pro /usr/share/qt4/mkspecs/linux-g++-64/qmake.conf /usr/share/qt4/mkspecs/common/unix.conf \
Makefile: i7z_GUI.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
/usr/share/qt4/mkspecs/common/gcc-base.conf \
/usr/share/qt4/mkspecs/common/gcc-base-unix.conf \
/usr/share/qt4/mkspecs/common/g++-base.conf \
/usr/share/qt4/mkspecs/common/g++-unix.conf \
/usr/share/qt4/mkspecs/qconfig.pri \
/usr/share/qt4/mkspecs/modules/qt_phonon.pri \
/usr/share/qt4/mkspecs/modules/qt_webkit_version.pri \
/usr/share/qt4/mkspecs/features/qt_functions.prf \
/usr/share/qt4/mkspecs/features/qt_config.prf \
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
/usr/share/qt4/mkspecs/features/default_pre.prf \
/usr/share/qt4/mkspecs/features/debug.prf \
/usr/share/qt4/mkspecs/features/default_post.prf \
/usr/share/qt4/mkspecs/features/shared.prf \
/usr/share/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
/usr/share/qt4/mkspecs/features/warn_on.prf \
/usr/share/qt4/mkspecs/features/qt.prf \
Expand All @@ -124,8 +130,8 @@ Makefile: i7z_GUI.pro /usr/share/qt4/mkspecs/linux-g++-64/qmake.conf /usr/share
/usr/share/qt4/mkspecs/features/yacc.prf \
/usr/share/qt4/mkspecs/features/lex.prf \
/usr/share/qt4/mkspecs/features/include_source_dir.prf \
/usr/lib/x86_64-linux-gnu/libQtGui.prl \
/usr/lib/x86_64-linux-gnu/libQtCore.prl
/usr/lib64/qt4/libQtGui.prl \
/usr/lib64/qt4/libQtCore.prl
$(QMAKE) -o Makefile i7z_GUI.pro
/usr/share/qt4/mkspecs/common/unix.conf:
/usr/share/qt4/mkspecs/common/linux.conf:
Expand All @@ -134,12 +140,15 @@ Makefile: i7z_GUI.pro /usr/share/qt4/mkspecs/linux-g++-64/qmake.conf /usr/share
/usr/share/qt4/mkspecs/common/g++-base.conf:
/usr/share/qt4/mkspecs/common/g++-unix.conf:
/usr/share/qt4/mkspecs/qconfig.pri:
/usr/share/qt4/mkspecs/modules/qt_phonon.pri:
/usr/share/qt4/mkspecs/modules/qt_webkit_version.pri:
/usr/share/qt4/mkspecs/features/qt_functions.prf:
/usr/share/qt4/mkspecs/features/qt_config.prf:
/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
/usr/share/qt4/mkspecs/features/default_pre.prf:
/usr/share/qt4/mkspecs/features/debug.prf:
/usr/share/qt4/mkspecs/features/default_post.prf:
/usr/share/qt4/mkspecs/features/shared.prf:
/usr/share/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
/usr/share/qt4/mkspecs/features/warn_on.prf:
/usr/share/qt4/mkspecs/features/qt.prf:
Expand All @@ -150,8 +159,8 @@ Makefile: i7z_GUI.pro /usr/share/qt4/mkspecs/linux-g++-64/qmake.conf /usr/share
/usr/share/qt4/mkspecs/features/yacc.prf:
/usr/share/qt4/mkspecs/features/lex.prf:
/usr/share/qt4/mkspecs/features/include_source_dir.prf:
/usr/lib/x86_64-linux-gnu/libQtGui.prl:
/usr/lib/x86_64-linux-gnu/libQtCore.prl:
/usr/lib64/qt4/libQtGui.prl:
/usr/lib64/qt4/libQtCore.prl:
qmake: FORCE
@$(QMAKE) -o Makefile i7z_GUI.pro

Expand Down Expand Up @@ -191,7 +200,7 @@ compiler_moc_source_clean:
i7z_GUI.moc: ../helper_functions.c \
../i7z.h \
i7z_GUI.cpp
/usr/lib/x86_64-linux-gnu/qt4/bin/moc $(DEFINES) $(INCPATH) i7z_GUI.cpp -o i7z_GUI.moc
/usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) i7z_GUI.cpp -o i7z_GUI.moc

compiler_uic_make_all:
compiler_uic_clean:
Expand Down
8 changes: 4 additions & 4 deletions GUI/i7z_GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
bool global_in_i7z_main_thread = false;
int socket_list[MAX_PROCESSORS_GUI];
int core_list[MAX_PROCESSORS_GUI];
struct cpu_heirarchy_info chi;
struct cpu_hierarchy_info chi;
struct cpu_socket_info socket_0, socket_1;
unsigned int numCPUs;
struct program_options prog_options;
Expand All @@ -58,9 +58,9 @@ void Construct_Socket_Information_in_GUI(unsigned int *numCPUs) {
for(i=0;i < 8; i++)
socket_1.processor_num[i]=-1;

construct_CPU_Heirarchy_info(&chi);
construct_CPU_Hierarchy_info(&chi);
construct_sibling_list(&chi);
// print_CPU_Heirarchy(chi);
// print_CPU_Hierarchy(chi);
construct_socket_information(&chi, &socket_0, &socket_1, socket_0_num, socket_1_num);
// print_socket_information(&socket_0);
// print_socket_information(&socket_1);
Expand Down Expand Up @@ -132,7 +132,7 @@ void
MyThread::run ()
{

print_CPU_Heirarchy(chi);
print_CPU_Hierarchy(chi);

int i, ii;

Expand Down
93 changes: 0 additions & 93 deletions GUI/i7z_GUI.moc

This file was deleted.

1 change: 1 addition & 0 deletions GUI/i7z_GUI.pro
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ INCLUDEPATH += .
CONFIG += debug
CFLAGS += #QMAKE_*FLAGS are where the gcc flags should be passed
CXXFLAGS +=
DEFINES += VERSION AUTHOR MESSAGE
QMAKE_CFLAGS += -v -fno-schedule-insns2 -fno-schedule-insns -fno-inline-small-functions -fno-caller-saves
QMAKE_CXXFLAGS += -v -fno-schedule-insns2 -fno-schedule-insns -fno-inline-small-functions -fno-caller-saves
# Input
Expand Down
14 changes: 0 additions & 14 deletions MAKEDEV-cpuid-msr

This file was deleted.

17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
# Makefile for i7z, GPL v2, License in COPYING
#

GIT_VERSION := $(shell git log --max-count 1 --pretty=format:"%H ( %cd )%n")
GIT_AUTHOR := $(shell git log --max-count 1 --pretty=format:"%cn%n ( %ce )%n")
GIT_MESSAGE := $(shell git log --max-count 1 --pretty=format:"%s%n" | sed -e 's/['\''"]//g')

#makefile updated from patch by anestling

#explicitly disable two scheduling flags as they cause segfaults, two more seem to crash the GUI version so putting them
#here
CFLAGS_FOR_AVOIDING_SEG_FAULT = -fno-schedule-insns2 -fno-schedule-insns -fno-inline-small-functions -fno-caller-saves
CFLAGS ?= -O3
CFLAGS += -DVERSION='"$(GIT_VERSION)"' -DAUTHOR='"$(GIT_AUTHOR)"' -DMESSAGE='"${GIT_MESSAGE}"'
CFLAGS += $(CFLAGS_FOR_AVOIDING_SEG_FAULT) -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DBUILD_MAIN -Wimplicit-function-declaration

LBITS := $(shell getconf LONG_BIT)
Expand All @@ -34,17 +39,13 @@ mandir ?= $(prefix)/share/man/

all: clean test_exist

message:
@echo "If the compilation complains about not finding ncurses.h, install ncurses (libncurses5-dev on ubuntu/debian)"

bin: message $(OBJ)
bin: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $(BIN) $(OBJ) $(LIBS)

#http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=644728 for -ltinfo on debian
static-bin: message $(OBJ)
static-bin: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $(BIN) $(OBJ) -static-libgcc -DNCURSES_STATIC -static -lpthread -lncurses -lrt -lm -ltinfo

# perfmon-bin: message $(OBJ)
# perfmon-bin: $(OBJ)
# $(CC) $(CFLAGS) $(LDFLAGS) -o $(PERFMON-BIN) perfmon-i7z.c helper_functions.c $(LIBS)

test_exist: bin
Expand All @@ -60,4 +61,4 @@ install: $(BIN)
install -D -m 0644 doc/i7z.man $(DESTDIR)$(mandir)man1/i7z.1
install -D -m 755 $(BIN) $(DESTDIR)$(sbindir)$(BIN)
install -d $(DESTDIR)$(docdir)
install -m 0644 README.txt put_cores_offline.sh put_cores_online.sh MAKEDEV-cpuid-msr $(DESTDIR)$(docdir)
install -m 0644 README.txt put_cores_offline.sh put_cores_online.sh $(DESTDIR)$(docdir)
Loading