As I remember, with gcc for Pentium it was possible to view advanced dump of compilation process, where gcc shows, how it plans (schedules) assembler instructions for U and V pipelines and also shows how many ticks (CPU clocks) will take each instruction.
Can you say, which versions of gcc can show such dumps and what option is to turn this on?
E.g. for Core2 there is a core2.md with decoders and execution ports defined, latencies for every instruction. I want to see, how gcc uses this and what decisions are done in instruction scheduling.
In other words: for example program:
int main() {
int i; int j=0;
for(i=0;i<1000000;i++)
j+=i^((i+5)&(i>>2)&(i>>5) + (i>>2)&(i>>5))-(i+5);
return j%250;
}
how can I get, how ticks are planned by gcc for each iteration?
I'm not sure exactly what you mean, but the -fsched-verbose=n (try with n=6) dumps some scheduling information which looks like what you're after.
.sched2 dump (possible to get it via -fsched-verbose=1 or -fdump-rtl-all or -fdump-rtl-all-all) contains needed information. E.g. for gcc 4.6.0 with -Ofast -march=native -mtune=native):
note the right part: c2_decoder# - is the decoder of Core2 planned; c2_p# is numbers of ports which are used.
;; ======================================================
;; -- basic block 4 from 65 to 79 -- after reload
;; ======================================================
;; 0--> 78 {sp=bp+0x4;bp=[bp];clobber [scratc:c2_decoder0,(c2_p2+(c2_p0|c2_p1)),c2_p0|c2_p1
;; 0--> 65 xmm0=xmm4 :c2_decodern,c2_p0|c2_p1|c2_p5
;; 0--> 36 dx=0x10624dd3 :c2_decodern,c2_p0|c2_p1|c2_p5
;; 1--> 31 xmm0=xmm0 0>>0x40 :c2_decodern,c2_p1
;; 2--> 32 xmm4=xmm4+xmm0 :c2_decodern,c2_p0|c2_p5
;; 3--> 67 xmm0=xmm4 :c2_decodern,c2_p0|c2_p1|c2_p5
;; 4--> 33 xmm0=xmm0 0>>0x20 :c2_decodern,c2_p1
;; 5--> 34 xmm4=xmm4+xmm0 :c2_decodern,c2_p0|c2_p5
;; 6--> 72 cx=xmm4 :c2_decodern,c2_p0|c2_p1|c2_p5
;; 7--> 69 ax=cx :c2_decodern,c2_p0|c2_p1|c2_p5
;; 8--> 37 {dx=trn(sxn(ax)*sxn(dx) 0>>0x20);c:c2_decodern,c2_p1
;; 8--> 70 ax=cx :c2_decodern,c2_p0|c2_p1|c2_p5
;; 9--> 39 {ax=ax>>0x1f;clobber flags;} :c2_decodern,c2_p0|c2_p5
;; 11--> 38 {dx=dx>>0x4;clobber flags;} :c2_decodern,c2_p0|c2_p5
;; 12--> 40 {dx=dx-ax;clobber flags;} :c2_decodern,c2_p0|c2_p1|c2_p5
;; 13--> 41 {dx=dx*0xfa;clobber flags;} :c2_decodern,c2_p1
;; 16--> 42 {cx=cx-dx;clobber flags;} :c2_decodern,c2_p0|c2_p1|c2_p5
;; 17--> 47 ax=cx :c2_decodern,c2_p0|c2_p1|c2_p5
;; 17--> 50 use ax :nothing
;; 18--> 79 return :c2_decoder0
;; Ready list (final):
;; total time = 18
Related
I am trying to replicate sg_inq through sg_raw
This is the command used:
inq_cmd := exec.Command("sg_raw", "-r", "512", "/dev/sg0", "12 00 00 00 60 00")
stdoutStderr, err := read_cmd.CombinedOutput()
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", stdoutStderr)
Output after execution is
Inq COMMAND :
exit status 1
Invalid command byte '12 00 00 00 60 00'
Inquire COMMAND :
2020/05/28 19:42:48 exit status 1
exit status 1
Invalid command byte '12 00 00 00 60 00'
Usage: sg_raw [OPTION]* DEVICE CDB0 CDB1 ...
Options:
-b, --binary Dump data in binary form, even when writing to stdout
-h, --help Show this message and exit
-i, --infile=IFILE Read data to send from IFILE (default: stdin)
-k, --skip=LEN Skip the first LEN bytes when reading data to send
-n, --nosense Don't display sense information
-o, --outfile=OFILE Write binary data to OFILE (def: hexdump to stdout)
-r, --request=RLEN Request up to RLEN bytes of data (data-in)
-R, --readonly Open DEVICE read-only (default: read-write)
-s, --send=SLEN Send SLEN bytes of data (data-out)
-t, --timeout=SEC Timeout in seconds (default: 20)
-v, --verbose Increase verbosity
-V, --version Show version information and exit
Between 6 and 256 command bytes (two hex digits each) can be specified
and will be sent to DEVICE. Lengths RLEN and SLEN are decimal by
default. Bidirectional commands accepted.
Simple example: Perform INQUIRY on /dev/sg0:
sg_raw -r 1k /dev/sg0 12 00 00 00 60 00
What's wrong in the command? It would be a great help! Thanks in advance!
I have a problem when trying to resolve MX records using Resolv::DNS. When I execute the following lines directly on my Mac in irb, everything works:
> require "resolv"
> Resolv::DNS.new.getresource("stackoverflow.com", Resolv::DNS::Resource::IN::MX)
=> #<Resolv::DNS::Resource::IN::MX:0x00007fba42812ff0 #preference=10, #exchange=#<Resolv::DNS::Name: alt4.aspmx.l.google.com.>, #ttl=243>
The same line executed inside a docker container returns an error:
> require "resolv"
> Resolv::DNS.new.getresource("stackoverflow.com", Resolv::DNS::Resource::IN::MX)
Resolv::ResolvError: DNS result has no information for stackoverflow.com
from /usr/local/lib/ruby/2.4.0/resolv.rb:492:in `getresource'
I think the problem is docker-machine. I'm running docker-machine configured by dinghy 4.6.3 (see https://github.com/codekitchen/dinghy) with the following configuration:
Boot2Docker version 18.01.0-ce, build HEAD : 0bb7bbd - Thu Jan 11 16:32:39 UTC 2018
Docker version 18.01.0-ce, build 03596f5
docker#dinghy:~$ busybox | head -1
BusyBox v1.27.2 (2017-10-30 14:58:40 UTC) multi-call binary.
And my docker container is based on ruby:2.4.3-stretch.
I'm not sure if it is simple an issue with the resolv.conf
docker#dinghy:~$ cat /etc/resolv.conf
nameserver 10.0.2.3
Is the config enough for mx lookups?
Update:
This is the dig response from within a container (not from the docker-machine itself, unfortunately the dig package doesn't ship with busybox):
root#3ef2090b7864:/usr/src/app# dig #10.0.2.3 MX stackoverflow.com
; <<>> DiG 9.10.3-P4-Debian <<>> #10.0.2.3 MX stackoverflow.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOTIMP, id: 32375
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;stackoverflow.com. IN MX
;; Query time: 0 msec
;; SERVER: 10.0.2.3#53(10.0.2.3)
;; WHEN: Tue Apr 03 14:29:30 CEST 2018
;; MSG SIZE rcvd: 46
I've installed dnscrypt-proxy form repos on Ubuntu 16.10, than I tested it against command:
dig txt debug.opendns.com
And got what I needed:
dig txt debug.opendns.com
; <<>> DiG 9.10.3-P4-Ubuntu <<>> txt debug.opendns.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48435
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;debug.opendns.com. IN TXT
;; ANSWER SECTION:
debug.opendns.com. 0 IN TXT "server m1.hkg"
debug.opendns.com. 0 IN TXT "flags 20 0 70 7950800000000000000"
debug.opendns.com. 0 IN TXT "originid 0"
debug.opendns.com. 0 IN TXT "actype 0"
debug.opendns.com. 0 IN TXT "source 31.192.111.175:43228"
debug.opendns.com. 0 IN TXT "**dnscrypt enabled** (717473654A614970)"
;; Query time: 279 msec
;; SERVER: 127.0.2.1#53(127.0.2.1)
;; WHEN: Mon Feb 20 18:18:24 CET 2017
;; MSG SIZE rcvd: 250
"dnscrypt enabled" so it's working.
Than I wanted to change opends server to a different one.
So at: /etc/default/dncrypt-proxy
I set:
DNSCRYPT_PROXY_RESOLVER_NAME=ns0.dnscrypt.is
And now I see no "dnscrypt enabled":
dig txt debug.opendns.com
;; Truncated, retrying in TCP mode.
; <<>> DiG 9.10.3-P4-Ubuntu <<>> txt debug.opendns.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 44963
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;debug.opendns.com. IN TXT
;; AUTHORITY SECTION:
opendns.com. 2077 IN SOA auth1.opendns.com. noc.opendns.com. 1487092083 16384 2048 1048576 2560
;; Query time: 442 msec
;; SERVER: 127.0.2.1#53(127.0.2.1)
;; WHEN: Mon Feb 20 18:23:51 CET 2017
;; MSG SIZE rcvd: 92
Website https://dnsleaktest.com/ confirms that I'm using 93-95-228-87.1984.is server.
Why there's no "dnscrypt enabled"?
I my DNS encrypted?
What am I doing wrong?
Looks like it's working as it should be and it's normal behaviour. Andrew gave me an answer:
http://www.webupd8.org/2014/08/encrypt-dns-traffic-in-ubuntu-with.html#comment-3165943154
I am reading from the shared memory a stream producing an infinite information output such as:
0x1 (TimeStamp) 12Bytes:11216 + 1771/(47999+1) (0.036896) delta= 0+ 1536/(47999+1) (0.032000) 11216.013361 23.534ms 2015.06.25 11:51:16.525
0x4 (ReferenceTime) 12Bytes:11215 + 24786286/(26999999+1) (0.918011) delta= 0+ 806359/(26999999+1) (0.029856) 11216.013376 -95.366ms 2015.06.25 11:51:16.525
0x6 (ProcessDelay) 4Bytes: 32 (0x20)
0x7 (ClockAccuracy) 8Bytes: offset=0.000ppm (+-0.000ppm)
0xb (ClockId) 8Bytes: 01 00 00 00 42 22 01 00
0x20001 (SampleRate) 4Bytes: 48000 (0xbb80)
0x20002 (Channels) 4Bytes: 6 (0x6)
0x20003 (PcmLevel) 24Bytes: -11041 -11541 -49076 -86121 -24846 -24382
0x20004 (PcmPeak) 24Bytes: -8088 -8697 -37244 -84288 -21437 -21769
0x2000e (DolbyDpMetadata) 39352Bytes:
Linear Time: 11216 + 1771/(47999+1) (0.036896) delta= 0+ 1536/(47999+1) (0.032000)
if i try to read the stream with the following command:
while read line;
do
echo "$line";
echo "im here!"
done < <(../tools/spucat adec-68)
wherespucat is a cpp binary exacutable that continuosly print out on console using printf() information about incoming data packets.
this is the result:
im here!
�k�G��E�x����b��h�������c����2��/n��-�U���QE�L�x���c�������������������������������x��4����O��M�����/��(������������������~��E�*�������;
im here!
������r��$�|��J�n�P�4�
if i start the script whit this command:
while read line;
do
echo "$line";
echo "im here!"
done < $(../tools/spucat adec-68)
it actually never go inside the while loop, just start to print out the stream whaiting for the end.
Is tehere a way to read it line by line and process it inside the while loop?
spucat is dumping to the standard error (no idea why), so to processing it must be redirect to the standard output:
while read -r line;
do
echo "$line";
echo "im here!"
done < <(../tools/spucat -p 4 adec-68 2>&1 > /dev/null)
I have a problem compiling a program I made in BASIC. It's a DOS simulator that I was making in attempts to see if it is posssible to write an operating system entirly in BASIC. Every time I try to compile, I get these messages:
!SYNTAX ERROR IN LINE 15, COLUMN 50
UNEXPECTED E
EXPECTING : OR END OF LINE
What do I change to sovle this?
10 PRINT
11 PRINT "Starting..."
12 PRINT
13 PRINT
14 INPUT "Type the location of the Command Interpretter:"; I$
15 IF I$ = "C:\WINDOWS\COMMAND.COM" THEN GOTO 14 ELSE GOTO 13
16 INPUT "C:\>"; D$
17 IF D$ = "FORMAT" GOTO 25
18 IF D$ = "FDISK" GOTO 47
19 IF D$ = "HELP" GOTO 16
20 IF D$ = "DIR" GOTO 16
21 IF D$ = "MKDIR" GOTO 16
22 IF D$ = "WIN" GOTO 16
23 IF D$ = "CD" GOTO 16
24 IF D$ = "DEL" GOTO 16
25 PRINT "WARNING, ALL DATA ON REMOVABLE DISK"
27 PRINT "DRIVE A: WILL BE LOST!"
28 INPUT "Proceed with Format (Y/N)"; F$
29 IF F$ = "Y" THEN GOTO 28
30 IF F$ = "N" THEN GOTO 16
31 PRINT
32 PRINT
33 PRINT
34 PRINT "Fotmatting 1.44MB"
35 PRINT "Format complete."
36 PRINT "Writing out file allocation table"
37 PRINT "Complete."
38 PRINT "Calculating free space (this may take several minutes)...................."
39 PRINT "Complete."
40 PRINT
41 INPUT "Volume Label (11 charchters, ENTER for none)"
42 PRINT
43 PRINT " 1,440MB total disk space"
44 PRINT " 1,440MB available on disk"
45 PRINT
46 PRINT " 512 bytes in each allocation unit."
47 PRINT " 32,624 allocation units available on disk."
48 PRINT "Volume Serial Number is 326A-1312"
49 GOTO 16
50 PRINT "Incorrect DOS Version"
51 PRINT
52 GOTO 16
I used Vintage BASIC 1.0.1 as the compiler. Anyone know what's going on?
Windoze NT
I don't think there is an ELSE keyword in vintage basic, which is why you're getting the unexpected 'E' error.
I assume vintage BASIC is unstructured BASIC, you can refer to the wikipedia article for an example:
http://en.wikipedia.org/wiki/BASIC_programming_language
Also, you have some duplicate line numbers for 26 and 27, which explains the other errors.
The first two warnings are caused by your program having two lines 26, and two lines 27.
I would guess that the third message comes from your BASIC only supporting IF THEN and not IF THEN ELSE. In this case, you can encode it with IF GOTO.
Are you sure your version of BASIC has ELSE? Not all have...
I guess you are learning to program, right? May I ask a question? Why Basic? I think there are a lot of more useful and powerful (and mainly using modern practices of programing) languages to learn that you can use in a graphic OS and they are not more complicated to learn like Python for example (my son has your age and he is loving python). It's a simple language for simple things but very powerful if you need (and complicated too!).
Good luck!
I note that you've changed the code originally posted, deleting the duplicate line numbers That will make the first part of this answer look weird, but I'll leave it.
The compiler is telling you that you're re-using the same line numbers. Notice the following section of code?
26 PRINT "DRIVE A: WILL BE LOST!"
27 INPUT "Proceed with Format (Y/N)"; F$
26 IF F$ = "Y" THEN GOTO 28
27 IF F$ = "N" THEN GOTO 16
The fix is to renumber your lines. Now you know why you don't usually use increments of 1 between lines in languages that require line numbers! (You can likely find - or even write - a tool to do it for you, however.)
Regarding the error from:
15 IF I$ = "C:\WINDOWS\COMMAND.COM" THEN GOTO 14 ELSE GOTO 13
I've not run across "Vintage BASIC" before, but assuming the other answers about it not supporting an else are correct, you'll want something like:
15 IF I$ = "C:\WINDOWS\COMMAND.COM" THEN GOTO 14
16 IF I$ <> "C:\WINDOWS\COMMAND.COM" THEN GOTO 13
You may need to replace "<>" with "!=" or whatever your BASIC uses as a not equal to operator. Also, you'll have to do more renumbering, since you already have a line 16.