Ottenere alcune informazioni sulla CPU mediante l'API di Libavutil
Vai alla navigazione
Vai alla ricerca
Con la libreria Libavutil è possibile ottenere alcune informazioni sulla CPU.
E' necessario aver installato e richiamare in Gambas la libreria condivisa: "libavutil.so.56.70.100 " oppure "libavutil.so.59.39.100.
Mostriamo un esempio pratico:
Library "libavutil:56.70.100" ' oppure "libavutil:59.39.100"
' int av_get_cpu_flags(void)
' Return the flags which specify extensions supported by the CPU.
Private Extern av_get_cpu_flags() As Integer
Public Sub Main()
Dim i, i2, c As Integer
Dim b As Byte
i = av_get_cpu_flags()
While c < &40000000
i2 = i And c
Select Case i2
Case 1
Print "standard MMX"
Case 2
Print "SSE integer functions or AMD MMX ext"
Case 4
Print "AMD 3DNOW"
Case 8
Print "SSE functions"
Case 16
Print "PIV SSE2 functions"
Case 32
Print "AMD 3DNowExt"
Case 64
Print "Prescott SSE3 functions"
Case 128
Print "Conroe SSSE3 functions"
Case 256
Print "Penryn SSE4.1 functions"
Case 512
Print "Nehalem SSE4.2 functions"
Case 1024
Print "Bulldozer XOP functions"
Case 2048
Print "Bulldozer FMA4 functions"
Case 4096
Print "i686 cmov"
Case 16384
Print "AVX functions"
Case 268435456
Print "Atom processor"
Case 536870912
Print "SSE3 supported"
Case 1073741824
Print "SSE2 supported"
End Select
c = 2 ^ b
Inc b
Wend
End