public MethodMap(SymbolTable symbols)
		{
			// set symbol table
			mSymbols = symbols;

			// this must be method 1
			AllocMethodId("global$init");
		}
Exemple #2
0
		private static void BeginSession(Stream stream, bool autoCloseStream = true)
		{
			// get application name
			var assembly = System.Reflection.Assembly.GetEntryAssembly(); 
			var appName = assembly.GetName().Name;
			var swfVersion = 21;
			var swfSize = 4 * 1024 * 1024;

			if (CategoryEnabledSampler || CategoryEnabledAllocTraces) {
				if (sSymbols == null) {
					// allocate symbol table for method map
					sSymbols = new SymbolTable();
				}
				// create method map if we need it
				sMethodMap = new MethodMap(sSymbols);
			}

			// create AMF writer from stream
			sLog = new Log(stream, autoCloseStream);

			// write telemetry version
			WriteValue(".tlm.version", Session.Version);
			WriteValue(".tlm.meta", (double)0.0);
			WriteValue(".tlm.date", new _root.Date().getTime());

			// write player info
			WriteValue(".player.version", "11,8,800,94");
//			WriteValue(".player.airversion", "3.8.0.910");
			WriteValue(".player.type", "PlayScript");
			WriteValue(".player.debugger", flash.system.Capabilities.isDebugger); 
			WriteValue(".player.global.date", new _root.Date().getTime());
			WriteValue(".player.instance", 0);
			WriteValue(".player.scriptplayerversion", swfVersion);

#if PLATFORM_MONOMAC
			// write platform info (this is faked)
			WriteValue(".platform.capabilities", "&M=Adobe%20Macintosh&R=1920x1200&COL=color&AR=1.0&OS=Mac%20OS%2010.7.4&ARCH=x86&L=en&PR32=t&PR64=t&LS=en;ja;fr;de;es;it;pt;pt-PT;nl;sv;nb;da;fi;ru;pl;zh-Hans;zh-Hant;ko;ar;cs;hu;tr");
			WriteValue(".platform.cpucount", 4);

			// write gpu info (this is faked)
			WriteValue(".platform.gpu.kind", "opengl");

#else
			// write platform info (this is faked)
			WriteValue(".platform.capabilities", "&M=Adobe iOS&R=640x960&COL=color&AR=1&OS=iPhone OS 6.1 iPhone5,1&ARCH=ARM&L=en&IME=false&PR32=true&PR64=false&LS=en;fr;de;ja;nl;it;es;pt;pt-PT;da;fi;nb;sv;ko;zh-Hans;zh-Hant;ru;pl;tr;uk;ar;hr;cs;el;he;ro;sk;th;id;ms;en-GB;ca;hu;vi");
			WriteValue(".platform.cpucount", 2);

			// write gpu info (this is faked)
			WriteValue(".platform.gpu.kind", "opengles2");
			WriteValue(".platform.gpu.vendor", "Imagination Technologies");
			WriteValue(".platform.gpu.renderer", "PowerVR SGX 535");
			WriteValue(".platform.gpu.version", "OpenGL ES 2.0 IMGSGX535-63.24");
			WriteValue(".platform.gpu.shadinglanguageversion", "OpenGL ES GLSL ES 1.0");
			WriteValue(".platform.3d.driverinfo", "OpenGL Vendor=Imagination Technologies Version=OpenGL ES 2.0 IMGSGX535-63.24 Renderer=PowerVR SGX 535 GLSL=OpenGL ES GLSL ES 1.0");
#endif


			// write memory stats
			WriteValue(".mem.total", 8 * 1024);
			WriteValue(".mem.used", 4 * 1024);
			WriteValue(".mem.managed", 0);
			WriteValue(".mem.managed.used", 0);
			WriteValue(".mem.telemetry.overhead", 0);

			// write telemetry categories
			WriteCategoryEnabled("3D", CategoryEnabled3D);
			WriteCategoryEnabled("sampler", CategoryEnabledSampler);
			WriteCategoryEnabled("displayobjects", CategoryEnabledDisplayObjects);
			WriteCategoryEnabled("alloctraces", CategoryEnabledAllocTraces);
			WriteCategoryEnabled("allalloctraces", CategoryEnabledAllAllocTraces);
			WriteCategoryEnabled("customMetrics", CategoryEnabledCustomMetrics);

			WriteValue(".network.loadmovie", "app:/" + appName );
			WriteValue(".rend.display.mode", "auto");

			// SWF startup timestamp
			WriteTime(".swf.start");

			// write swf stats
			WriteSWFStats(appName, 800, 600, 60, swfVersion, swfSize);

			// write memory stats
			WriteMemoryStats();

			// start categories
			if (CategoryEnabledAllocTraces) {
				WriteValue(".tlm.category.start", "alloctraces");
			}

			if (CategoryEnabledCustomMetrics) {
				WriteValue(".tlm.category.start", "customMetrics");
			}

			if (CategoryEnabledSampler) {
				WriteValue(".tlm.category.start", "sampler");
			}

			// enable 'advanced telemetry'
			WriteValue(".tlm.detailedMetrics.start", true);

			Flush();

			if (CategoryEnabledSampler) {
				// start sampler
				sSampler = new Sampler(sLog.StartTime, sLog.Divisor, SamplerRate, SamplerMaxCallStackDepth, SamplerStartDelay);
			}
		}