示例#1
0
	def __runTest2KP(self,test,repetitions,triple):
		# connessione automatica
		smartSpace=SmartSpaceData()
		smartSpace.setSmartSpaceName("X")
		smartSpace.setIPADDR("localhost")
		smartSpace.setPort(10010)

		if not smartSpace.joinSpace():
			sys.exit('Could not join to Smart Space')

		node=smartSpace.getNode()
		ss_handle = smartSpace.getSmartSpace()

		elapsedTime=[]
		if test == "insert":
			for index in range(repetitions):
				qs=node.CreateInsertTransaction(ss_handle)
				start=time.time()
				qs.send(triple, confirm = True)
				elapsedTime.append(time.time()-start)
				node.CloseInsertTransaction(qs)

				qs=node.CreateRemoveTransaction(ss_handle)
				qs.remove(triple, confirm = True)
				node.CloseRemoveTransaction(qs)
		if test == "remove":
			for index in range(repetitions):
				qs=node.CreateInsertTransaction(ss_handle)
				qs.send(triple, confirm = True)
				node.CloseInsertTransaction(qs)

				qs=node.CreateRemoveTransaction(ss_handle)
				start=time.time()
				qs.remove(triple, confirm = True)
				elapsedTime.append(time.time()-start)
				node.CloseRemoveTransaction(qs)
		smartSpace.leaveSpace()
		return sum(elapsedTime)/len(elapsedTime)
示例#2
0
文件: test_2 .py 项目: h0st/pygcss
from M3Utility.SubscriptionPerformanceTest import *
from M3Utility.ProtectionPerformanceTest import *
from M3Utility.Utility import SmartSpaceData
from M3Utility.StringPerformanceTest import *
from time import sleep
import os

if __name__ == "__main__":
    
	# connessione automatica
	smartSpace=SmartSpaceData()
	smartSpace.setSmartSpaceName("X")
	smartSpace.setIPADDR("localhost")
	smartSpace.setPort(10010)

	if not smartSpace.joinSpace():
		sys.exit('Could not join to Smart Space')

	node=smartSpace.getNode()
	ss_handle = smartSpace.getSmartSpace()

	# creazione grafo
	pieces=[]
	pieces.append(PieceOfRDFGraph("ClasseA","IstanzaA","AttributoA"))
	pieces.append(PieceOfRDFGraph("ClasseB","IstanzaB","AttributoB"))
	pieces.append(PieceOfRDFGraph("ClasseC","IstanzaC","AttributoC"))
	pieces.append(PieceOfRDFGraph("ClasseD","IstanzaD","AttributoD"))
	pieces.append(PieceOfRDFGraph("ClasseE","IstanzaE","AttributoE"))
	pieces.append(PieceOfRDFGraph("ClasseF","IstanzaF","AttributoF"))
	pieces.append(PieceOfRDFGraph("ClasseG","IstanzaG","AttributoG"))
	pieces.append(PieceOfRDFGraph("ClasseH","IstanzaH","AttributoH"))