-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from gnudatalanguage/master
align
- Loading branch information
Showing
10 changed files
with
373 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
; | ||
; Under GNU GPL V3+ | ||
; Alain C., October 2018 | ||
; | ||
; Frequently, we just want to copy in a STRING Array all the lines | ||
; of an ACSII file ... | ||
; | ||
function READ_ASCII_BASIC, filename, $ | ||
test=test, verbose=verbose, help=help | ||
; | ||
if (KEYWORD_SET(help) or (N_PARAMS() NE 1)) then begin | ||
print, 'function READ_ASCII_BASIC, filename, $' | ||
print, ' test=test, verbose=verbose, help=help' | ||
return, '' | ||
endif | ||
; | ||
ON_ERROR, 2 | ||
; | ||
if N_ELEMENTS(filename) GT 1 then MESSAGE, 'Only one file at once !' | ||
if ~FILE_TEST(filename) then MESSAGE, 'Missing file >>'+filename+'<<' | ||
if FILE_TEST(filename, /zero) then $ | ||
MESSAGE, 'File >>'+filename+'<< does exist but has zero-length' | ||
; | ||
txt='' | ||
restxt='' | ||
; | ||
GET_LUN, lun | ||
OPENR, lun, filename | ||
; | ||
while ~EOF(lun) do begin | ||
READF, lun, txt | ||
;;print, txt | ||
restxt=[restxt,txt] | ||
endwhile | ||
; | ||
CLOSE, lun | ||
FREE_LUN, lun | ||
; | ||
if N_ELEMENTS(restxt) GT 1 then restxt=restxt[1:*] | ||
if KEYWORD_SET(verbose) then begin | ||
print, 'File : ', filename, ' read with ', N_ELEMENTS(restxt), ' lines.' | ||
endif | ||
; | ||
if KEYWORD_SET(test) then STOP | ||
; | ||
return, restxt | ||
; | ||
end | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
; | ||
; AC, July 2017, GPL V3+ | ||
; | ||
; Collecting informations on the CPU | ||
; -- processor name | ||
; -- cores number <<-- tricks on OSX due to OpenMP | ||
; -- bogomips <<-- does not exist on OSX | ||
; -- cpu MHz | ||
; | ||
; Help welcome (MSwin ... BSD ...) | ||
; | ||
function BENCHMARK_INFO_CPU, test=test, verbose=verbose, help=help | ||
; | ||
if KEYWORD_SET(help) then begin | ||
print, 'function BENCHMARK_INFO_CPU, test=test, verbose=verbose, help=help' | ||
return, -1 | ||
endif | ||
; | ||
os_name=STRLOWCASE(!version.os) | ||
; | ||
if (os_name EQ 'linux') then begin | ||
;; | ||
SPAWN, 'more /proc/cpuinfo | grep MHz', resu_Mhz | ||
resu_mhz=STRMID(resu_Mhz[0], STRPOS(resu_Mhz[0],':')+2) | ||
resu_mhz=FLOAT(resu_mhz) | ||
;; | ||
SPAWN, 'more /proc/cpuinfo | grep bogo', resu_bogo | ||
resu_bogo=STRMID(resu_bogo[0], STRPOS(resu_bogo[0],':')+2) | ||
resu_bogo=FLOAT(resu_bogo) | ||
;; | ||
SPAWN, 'more /proc/cpuinfo | grep "model name"', model_name | ||
model_name=STRMID(model_name[0], STRPOS(model_name[0],':')+2) | ||
;; | ||
endif | ||
; | ||
if (os_name EQ 'darwin') then begin | ||
;; | ||
SPAWN, 'sysctl -n hw.cpufrequency', resu_Hz | ||
resu_Mhz=resu_Hz/1.e6 | ||
;; | ||
;; no known equivalent of BogoMIPS on OSX :( | ||
resu_bogo=-1 | ||
;; | ||
SPAWN, 'sysctl -n machdep.cpu.brand_string', model_name | ||
;; | ||
endif | ||
; | ||
info_cpu={MHz : resu_Mhz, $ | ||
Bogo : resu_bogo, $ | ||
model : model_name, $ | ||
used_cores : !cpu.tpool_nthreads, $ | ||
nb_cores : !cpu.hw_ncpu} ; not fully clear ... | ||
; | ||
if KEYWORD_SET(verbose) then HELP,/struct, info_cpu | ||
if KEYWORD_SET(test) then STOP | ||
; | ||
return, info_cpu | ||
; | ||
end | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
; | ||
; AC, Octobre 201_, GPL V3+ | ||
; | ||
; Collecting informations on the Machine | ||
; -- hostname | ||
; -- detailed info on the OS | ||
; | ||
; Help welcome (MSwin ... BSD ...) | ||
; | ||
; ---------------------------------------- | ||
; | ||
function BENCHMARK_INFO_OS, test=test, verbose=verbose, help=help | ||
; | ||
if KEYWORD_SET(help) then begin | ||
print, 'function BENCHMARK_INFO_OS, test=test, verbose=verbose, help=help' | ||
return, -1 | ||
endif | ||
; | ||
info_os={hostname :'', $ | ||
generic_osname : 'TBD', $ | ||
family_osname : 'TBD', $ | ||
accurate_osname : 'TBD'} | ||
; | ||
machine=GET_LOGIN_INFO() | ||
info_os.hostname=machine.machine_name | ||
; | ||
os_name=STRLOWCASE(!version.os) | ||
; | ||
if (os_name EQ 'linux') then begin | ||
;; | ||
info_os.generic_osname='Linux' | ||
;; | ||
txt='' & restxt='' | ||
filename='/etc/os-release' | ||
if FILE_TEST(filename) then begin | ||
txt=READ_ASCII_BASIC(filename) | ||
endif else begin | ||
MESSAGE, /continue, 'missing file : '+filename | ||
MESSAGE, /continue, 'no Linux OS specific info collected' | ||
endelse | ||
;; | ||
ok=WHERE(STRPOS(txt,'NAME=') EQ 0, nbp_ok) | ||
if (nbp_ok GE 1) then begin | ||
tmp=txt[ok] | ||
tmp=strmid(tmp, STRLEN('NAME=')) | ||
info_os.family_osname=STRJOIN(STRSPLIT(tmp,'"', /EXTRACT),'') | ||
endif else info_os.family_osname=os_name+' (unknown)' | ||
;; | ||
ok=WHERE(STRPOS(txt,'VERSION=') GE 0, nbp_ok) | ||
if (nbp_ok GE 1) then begin | ||
tmp=txt[ok] | ||
tmp=strmid(tmp, STRLEN('VERSION=')) | ||
info_os.accurate_osname=STRJOIN(STRSPLIT(tmp,'"', /EXTRACT),'') | ||
endif else info_os.accurate_osname=os_name+' (unknown)' | ||
;; | ||
endif | ||
; | ||
if (os_name EQ 'darwin') then begin | ||
;; | ||
info_os.generic_osname='OSX' | ||
;; | ||
SPAWN, 'sw_vers', txt | ||
tmp=txt[1] | ||
tmp=strmid(tmp, STRLEN('ProductVersion:')) | ||
info_os.accurate_osname=tmp | ||
;; | ||
endif | ||
; | ||
if KEYWORD_SET(verbose) then HELP,/struct, info_os | ||
if KEYWORD_SET(test) then STOP | ||
; | ||
return, info_os | ||
; | ||
end | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
; | ||
; AC, October 21, 2018, GPL V3+ | ||
; | ||
; Collecting informations on the interpreter version (GDL or IDL or FL) | ||
; -- soft | ||
; -- version | ||
; | ||
function BENCHMARK_INFO_SOFT, test=test, verbose=verbose, help=help | ||
; | ||
if KEYWORD_SET(help) then begin | ||
print, 'function BENCHMARK_INFO_SOFT, test=test, verbose=verbose, help=help' | ||
return, -1 | ||
endif | ||
; | ||
info_soft={name : '', release : ''} | ||
info_soft.name=GDL_IDL_FL() | ||
; | ||
if info_soft.name EQ 'GDL' then version=!gdl.release | ||
if info_soft.name EQ 'IDL' then version=!version.release | ||
if info_soft.name EQ 'FL' then version='Unknown' | ||
; | ||
if KEYWORD_SET(verbose) then HELP,/struct, info_soft | ||
if KEYWORD_SET(test) then STOP | ||
; | ||
return, info_soft | ||
; | ||
end | ||
; |
Oops, something went wrong.