Ignore:
Timestamp:
Feb 14, 2018, 6:23:44 PM (19 months ago)
Author:
mabarracus
Message:

Update test client to allow platform data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lliurex-analytics-server/trunk/fuentes/testing_utils/test_analytics.py

    r6773 r6820  
    3535STATS_ON=1              # req/s stats
    3636
     37USE_PLATFORM_DATA=False
    3738MAX_RANDOM_CLIENTS=50000
    3839DEBUG=0
    3940SHOW_BY_APP=True
    4041PAUSE_SHOW_STATS=False
    41 PAUSE_WITH_DATE_ROUNDS=True
     42PAUSE_WITH_DATE_ROUNDS=False
    4243# STAT COUNTERS
    4344NPET=0
     
    99100
    100101
     102ARCHS=['x86_64','i386']
    101103
    102104class DB():
     
    154156        self.updates=0
    155157        self.inc_date=0
     158        if USE_PLATFORM_DATA:
     159            pdata = self.gen_platform_data()
     160            for att in pdata:
     161                setattr(self,att,pdata[att])
     162
     163    def gen_platform_data(self):
     164        data = {}
     165        rnd=random.randint(1,8000)
     166        data['arch']=ARCHS[rnd%2]
     167        data['mem']=str(rnd*1024)
     168        data['vga']='VGA '+ data['mem'][0:2]
     169        data['cpu']='CPU '+ data['mem'][1:3]
     170        data['ncpu']=str((rnd%3)+1)
     171        return data
    156172
    157173    def info(self):
     
    226242        tmp['stats']=json.dumps(apps)
    227243        tmp['uid']=self.mac
     244        if USE_PLATFORM_DATA:
     245            tmp['specs'] = {}
     246            tmp['specs']['mac']=self.mac
     247            tmp['specs']['arch']=self.arch
     248            tmp['specs']['mem']=self.mem
     249            tmp['specs']['vga']=self.vga
     250            tmp['specs']['cpu']={'model':self.cpu,'ncpus':self.ncpu}
    228251        if self.inc_date > 0:
    229252            d=datetime.today()+relativedelta(months=0-self.inc_date)
Note: See TracChangeset for help on using the changeset viewer.