Ejemplo n.º 1
0
 async def B(self, ctx, swit: str):
     """B + (is xxx)"""
     if swit == 'greet':
         await ctx.send('こんにちは! BBBot('+VERSION+')だよ。\nよろしくね')
     elif swit == 'sysinfo':
         ipInfo = 'IP :'+socket.gethostname()+': '+socket.gethostbyname(socket.gethostname())
         platInfo = 'OS : '+platform.platform()
         cpuInfo = 'CPU: '+cpuid.cpu_name()
         #cpuInfo = 'CPU: ['+str(psutil.cpu_count(logical=False))+'C '+str(psutil.cpu_count())+'T]'
         memInfo = 'MEM: '+str('{:.2f}'.format(psutil.virtual_memory().used/(1024*1024)))+'MB / '+str('{:.2f}'.format(psutil.virtual_memory().total/(1024*1024)))+'MB'
         await ctx.send(ipInfo+"\n"+platInfo+"\n"+cpuInfo+"\n"+memInfo)
     elif swit == 'hello':
         await ctx.send('Hello B!')
     elif swit == 'block':
         await ctx.send('□□□□□□□□\n□■■■■□□□\n□■□□□■□□\n□■□□□■□□\n□■■■■□□□\n□■□□□■□□\n□■□□□□■□\n□■□□□□■□\n□■■■■■□□\n□□□□□□□□')
     elif swit == 'typing':
         async with ctx.typing():
             time.sleep(10)
             ctx.typing()
             await ctx.send('B')
     # elif swit == 'help':
     #     await ctx.send('?add, ?sub, ?mul, ?div : 計算\n?BLOOP n : Bを連続送信します\n?B greet, hello, help, block : あいさつ, Hello B!, ヘルプ, □と■のB')
     # elif swit == 'is GOD':
     #     await ctx.send('B IS GOD!')
     # elif swit == 'is CAT':
     #     await get_pic(self, ctx, 'https://cdn.discordapp.com/attachments/733937061199085610/766527935377047552/neko.png', 'uchuu_neko.png')
     # elif swit == 'is DOG':
     #     await get_pic(self, ctx, 'https://cdn.discordapp.com/attachments/705099416083890281/767549816862539846/camera_dog.png', 'camera_dog.png')
     # elif swit == 'is POT':
     #     await ctx.send('418: https://www.google.com/teapot')
     else:
         await ctx.send('B!')
Ejemplo n.º 2
0
def cpu(is_x86, is_64bit):
    cpu = CpuFeatures(name=platform.processor(),
                      vendor=platform.platform(),
                      arch=platform.machine(),
                      sse41=False,
                      sse42=False,
                      aes=False,
                      avx=False,
                      avx2=False)

    if is_x86:
        from cpuid import _is_set, cpu_vendor, cpu_name, cpu_microarchitecture

        cpu = CpuFeatures(
            name=cpu_name().rstrip('\x00'),
            vendor=cpu_vendor(),
            arch=cpu_microarchitecture()[0],
            sse41=_is_set(1, 2, 19) == 'Yes',
            sse42=_is_set(1, 2, 20) == 'Yes',
            aes=_is_set(1, 2, 25) == 'Yes',
            avx=_is_set(1, 2, 28) == 'Yes',
            avx2=_is_set(7, 1, 5) == 'Yes',
        )

    logging.getLogger().info("CPU %s", cpu)

    return cpu
Ejemplo n.º 3
0
 async def sysinfo(self, ctx):
     ipInfo = 'IP :'+socket.gethostname()+': '+socket.gethostbyname(socket.gethostname())
     platInfo = 'OS : '+platform.platform()
     cpuInfo = 'CPU: '+cpuid.cpu_name()
     #cpuInfo = 'CPU: ['+str(psutil.cpu_count(logical=False))+'C '+str(psutil.cpu_count())+'T]'
     memInfo = 'MEM: '+str('{:.2f}'.format(psutil.virtual_memory().used/(1024*1024)))+'MB / '\
         +str('{:.2f}'.format(psutil.virtual_memory().total/(1024*1024)))+'MB'
     await ctx.send(ipInfo+"\n"+platInfo+"\n"+cpuInfo+"\n"+memInfo)
Ejemplo n.º 4
0
def check_hardware():
    """
    checks the hardware
    """
    print("Checking Hardware:")
    print("  => Vendor ID         : %s" % cpu_vendor())
    print("  => CPU name          : %s" % cpu_name())
    print("  => Microarchitecture : %s%s" % cpu_microarchitecture())
    print("  => Vector instructions supported:")
    print("     -> SSE    : %s" % has_instruction(1, 3, 25))
    print("     -> SSE2   : %s" % has_instruction(1, 3, 26))
    print("     -> SSE3   : %s" % has_instruction(1, 2, 0))
    print("     -> SSSE3  : %s" % has_instruction(1, 2, 9))
    print("     -> SSE4.1 : %s" % has_instruction(1, 2, 19))
    print("     -> SSE4.2 : %s" % has_instruction(1, 2, 20))
    print("     -> SSE4a  : %s" % has_instruction(0x80000001, 2, 6))
    print("     -> AVX    : %s" % has_instruction(1, 2, 28))
    print("     -> AVX2   : %s" % has_instruction(7, 1, 5))
    print("     -> BMI1   : %s" % has_instruction(7, 1, 3))
    print("     -> BMI2   : %s" % has_instruction(7, 1, 8))
    print("\n")

    if has_instruction(1, 2, 28) != "Yes":
        print("  => ATTENTION: instruction set AVX is needed")
Ejemplo n.º 5
0
P(speedup > 0) = {:.4f}

Vendor ID         : {:s}
CPU Name          : {:s}
Microarchitecture : {:s}

'''.format(
        str(df), str(df.describe()), args.loop, df_mean['nps_e1'],
        df_std['nps_e1'], df_mean['nps_e2'], df_std['nps_e2'],
        df_mean['nps_diff'], df_std['nps_diff'],
        df_mean['nps_diff'] / df_mean['nps_e1'],
        statsmodels.stats.weightstats.ttest_ind(df['nps_e1'].values,
                                                df['nps_e2'].values,
                                                alternative='larger',
                                                usevar='unequal')[1],
        cpuid.cpu_vendor(), cpuid.cpu_name(),
        '%s%s' % cpuid.cpu_microarchitecture()))
else:
    logger.info('''

{:s}

{:s}

Result of {:d} runs
==================
base           = {:10.0f} +/- {:.0f}

Vendor ID         : {:s}
CPU Name          : {:s}
Microarchitecture : {:s}