Differenze tra le versioni di "Ottenere alcune informazioni sulla CPU mediante l'API di Libavutil"

Da Gambas-it.org - Wikipedia.
(Creata pagina con "Con la libreria '''Libavutil''' è possibile ottenre alcune informazioni sulla CPU. E' necessario aver installato e richiamare in Gambas la libreria inmica condivisa: "''liba...")
 
 
(2 versioni intermedie di uno stesso utente non sono mostrate)
Riga 1: Riga 1:
Con la libreria '''Libavutil''' è possibile ottenre alcune informazioni sulla CPU.
+
Con la libreria '''Libavutil''' è possibile ottenere alcune informazioni sulla CPU.
 
 
E' necessario aver installato e richiamare in Gambas la libreria inmica condivisa: "''libavutil.so.52.3.0''"
 
  
 +
E' necessario aver installato e richiamare in Gambas la libreria condivisa: "''libavutil.so.56.70.100'' ".
  
 
Mostriamo un esempio pratico:
 
Mostriamo un esempio pratico:
  Library "libavutil:52.3.0"
+
  Library "libavutil:56.70.100"
 
   
 
   
 
  <FONT Color=gray>' ''int av_get_cpu_flags(void)''
 
  <FONT Color=gray>' ''int av_get_cpu_flags(void)''
Riga 12: Riga 11:
 
   
 
   
 
   
 
   
  '''Public''' Sub Main()
+
  Public Sub Main()
 
+
 
   Dim i, i2, c As Integer
 
   Dim i, i2, c As Integer
 
   Dim b As Byte
 
   Dim b As Byte
    
+
  i = av_get_cpu_flags()
+
   i = av_get_cpu_flags()
 
    
 
    
  While c < &40000000
+
  While c < &40000000
    i2 = i And c
+
    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
 
    
 
    
    Select Case i2
+
  End
      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'''
 
 
 
  
  

Versione attuale delle 21:18, 7 giu 2023

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 ".

Mostriamo un esempio pratico:

Library "libavutil:56.70.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


Riferimenti