本文整理汇总了Java中android.util.TimingLogger类的典型用法代码示例。如果您正苦于以下问题:Java TimingLogger类的具体用法?Java TimingLogger怎么用?Java TimingLogger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TimingLogger类属于android.util包,在下文中一共展示了TimingLogger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBestMatched
import android.util.TimingLogger; //导入依赖的package包/类
public static Pair<Point, Double> getBestMatched(Mat tmResult, int matchMethod, float threshold) {
TimingLogger logger = new TimingLogger(LOG_TAG, "best_matched_point");
// FIXME: 2017/11/26 正交化?
// Core.normalize(tmResult, tmResult, 0, 1, Core.NORM_MINMAX, -1, new Mat());
Core.MinMaxLocResult mmr = Core.minMaxLoc(tmResult);
logger.addSplit("minMaxLoc");
double value;
Point pos;
if (matchMethod == Imgproc.TM_SQDIFF || matchMethod == Imgproc.TM_SQDIFF_NORMED) {
pos = mmr.minLoc;
value = -mmr.minVal;
} else {
pos = mmr.maxLoc;
value = mmr.maxVal;
}
logger.addSplit("value:" + value);
logger.dumpToLog();
return new Pair<>(pos, value);
}
示例2: save
import android.util.TimingLogger; //导入依赖的package包/类
/**
* Saves nodes to disk
*/
public void save() throws IOException {
TimingLogger timing = new TimingLogger(TAG, "save");
// yes, parcels are not meant for persisting to disk, but they are convenient and fast
// we are only serializing "simple" data (no binders etc)
// + losing serialized data here would not be a problem as users can almost always refresh node data
Parcel parcel = Parcel.obtain();
parcel.writeTypedList(this.nodes);
File f = getFile();
FileOutputStream fileOutputStream = new FileOutputStream(f);
byte[] buffer = parcel.marshall();
parcel.recycle();
fileOutputStream.write(buffer);
fileOutputStream.close();
timing.dumpToLog();
}
示例3: create
import android.util.TimingLogger; //导入依赖的package包/类
public static <T extends ISubject> T create (Class<T> type) {
if (type == null) {
return null;
}
return (T) Proxy.newProxyInstance(type.getClassLoader(), new Class[]{type}, new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
String tag = method.getName();
String label = method.getName();
TimingLogger timings = new TimingLogger(tag, label);
// method.invoke(proxy, args);
timings.dumpToLog();
return proxy;
}
});
}
示例4: onProgressChanged
import android.util.TimingLogger; //导入依赖的package包/类
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
{
float amount = (float)progress / seekBar.getMax();
TimingLogger timings = new TimingLogger(TAG, "makeup");
applyCosmestic(MakeupActivity.this, makeup, region, textures, colors, amount);
timings.addSplit("applyCosmestic");
timings.dumpToLog();
iv_image.setImageBitmap(makeup.getIntermediateImage());
}
示例5: refreshNodes
import android.util.TimingLogger; //导入依赖的package包/类
private void refreshNodes() {
boolean mapNotInitialized = clusterManager == null;
if (mapNotInitialized)
return;
TimingLogger timing = new TimingLogger(TAG, "refreshNodes");
// refresh screen
clusterManager.onCameraChange(googleMap.getCameraPosition());
timing.addSplit("update map");
timing.dumpToLog();
}
示例6: fetchNodeList
import android.util.TimingLogger; //导入依赖的package包/类
/**
* Fetches a node list from the server
*
* @return The parsed nodes
* @throws IOException
* @throws HttpException
*/
public static List<Node> fetchNodeList() throws IOException, HttpException {
TimingLogger timing = new TimingLogger(TAG, "fetchNodeList");
HttpURLConnection conn = (HttpURLConnection) new URL("http://freifunk.inmotion-sst.de/cache/result_routers.json").openConnection();
conn.setRequestMethod("GET");
conn.setAllowUserInteraction(false);
conn.setConnectTimeout(3000);
conn.connect();
if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) {
throw new HttpException("GET did not return 200-OK");
}
timing.addSplit("connect");
InputStream inputStream = conn.getInputStream();
ObjectMapper mapper = new ObjectMapper();
List<Node> result = mapper.readValue(inputStream, new TypeReference<ArrayList<Node>>() {
});
timing.addSplit("parsed " + result.size());
timing.dumpToLog();
return result;
}
示例7: load
import android.util.TimingLogger; //导入依赖的package包/类
/**
* Loads nodes from disk
*/
public static List<Node> load(Context context) {
TimingLogger timing = new TimingLogger(TAG, "load");
ArrayList<Node> nodes = new ArrayList<>();
try {
Parcel parcel = Parcel.obtain();
File f = getFile(context);
FileInputStream fileInputStream = new FileInputStream(f);
byte[] buffer = new byte[(int) f.length()];
fileInputStream.read(buffer, 0, buffer.length);
fileInputStream.close();
parcel.unmarshall(buffer, 0, buffer.length);
parcel.setDataPosition(0);
parcel.readTypedList(nodes, Node.CREATOR);
parcel.recycle();
timing.addSplit("loaded " + nodes.size());
// trim
nodes.removeAll(Collections.singleton(null));
timing.addSplit("trimmed nulls" + nodes.size());
} catch (Exception e) {
Log.d(TAG, "load encountered exception, this is not a problem", e);
}
timing.dumpToLog();
return nodes;
}
示例8: doCrawl
import android.util.TimingLogger; //导入依赖的package包/类
public List<PreferenceIndex> doCrawl() {
final TimingLogger logger = new TimingLogger(TAG, "doCrawl");
List<PreferenceIndex> indexablePreferences = new ArrayList<>();
List<BaseIndexableFragment> indexableFragments = IndexableFragments.values();
for (BaseIndexableFragment indexableFragment : indexableFragments) {
indexablePreferences.addAll(indexableFragment.index(mContext));
logger.addSplit("processed " + indexableFragment.fragmentName);
}
logger.addSplit("Finish crawling");
logger.dumpToLog();
return indexablePreferences;
}
示例9: writeJson
import android.util.TimingLogger; //导入依赖的package包/类
public void writeJson(User user) throws JSONException {
TimingLogger timingLogger = new TimingLogger("TIMER", "fetchCommodities");
Dhis2Endpoint service = dhis2EndPointFactory.getEndPoint(user);
DataSetSearchResponse response = service.searchDataSets("LMIS", "id,name,periodType,description,dataElements[name,id,attributeValues[value,attribute[id,name]],dataElementGroups[id,name,dataElementGroupSet[id,name],attributeValues[value,attribute[id,name]]");
timingLogger.addSplit("fetch data");
timingLogger.dumpToLog();
List<DataElementGroupSet> dataElementGroupSets = getGroupSets(response.getDataSets());
writeDataElementGroupSets(dataElementGroupSets);
}
示例10: fetchCategories
import android.util.TimingLogger; //导入依赖的package包/类
@Override
public List<Category> fetchCategories(User user) {
TimingLogger timingLogger = new TimingLogger("TIMER", "fetchCommodities");
Dhis2Endpoint service = dhis2EndPointFactory.getEndPoint(user);
DataElementGroupSetSearchResponse response = service.getDataElementGroupSets("id,name, dataElementGroups[id,name, attributeValues[value,attribute[id,name]], dataElements[name,id,attributeValues[value,attribute[id,name]]]");
timingLogger.addSplit("fetch data");
timingLogger.dumpToLog();
List<DataSet> dataSets = fetchDataSets(user);
List<DataElementGroupSet> androidDataElementGroupSets = getAndroidDataElementGroupSets(response.getDataElementGroupSets());
List<Category> categories = getCategoriesFromDataElementGroupSets(androidDataElementGroupSets, dataSets);
categories = addIndicatorCommodityActions(categories, user);
return categories;
}
示例11: onUpdate
import android.util.TimingLogger; //导入依赖的package包/类
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
super.onUpdate(context, appWidgetManager, appWidgetIds);
TimingLogger logger = new TimingLogger(TAG, "onUpdate");
logger.addSplit("method start");
RemoteViews remoteView = null;
Intent intent = new Intent(context, MainActivity.class);
intent.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
// Get data from database here
SentCountDataManager dataManager = SentCountDataManager.newInstance();
logger.addSplit("get data from database");
SentCountDetailsVo detailsVo = dataManager.getSentCountData(context);
logger.addSplit("read done, updating widgets");
// If not set in the settings, cycleLimit would be -1
int cycleLimit = (detailsVo.getCycleLimit() > 0) ? detailsVo.getCycleLimit() : 0;
// update all the app widgets
for (int i = 0; i < appWidgetIds.length; i++) {
remoteView = new RemoteViews(context.getPackageName(), R.layout.widget_layout);
// update data here
remoteView.setCharSequence(R.id.widgetSentTodayText, METHOD_SET_TEXT, "" + detailsVo.getSentToday());
remoteView.setCharSequence(R.id.widgetSentInCycleText, METHOD_SET_TEXT, detailsVo.getSentCycle() + " / "
+ cycleLimit);
remoteView.setOnClickPendingIntent(R.id.appWidget, pendingIntent);
appWidgetManager.updateAppWidget(appWidgetIds[i], remoteView);
}
// Logging for debug purposes
logger.addSplit("complete");
logger.dumpToLog();
}
示例12: processKMean
import android.util.TimingLogger; //导入依赖的package包/类
public void processKMean(ClusterPoint[] points)
{
TimingLogger timings = new TimingLogger(TAG, "processKMean()");
// create random cluster centers
initKMeanProcess(points, numOfCluster);
timings.addSplit("initKMeanProcess(): values=" + points.length);
int count = 1;
while(count < maxRound)
{
updateClusters(points, mCenters);
timings.addSplit("updateClusters() count " + count);
calcClusterCenters(points, mNewCenters);
count++;
timings.addSplit("reCalcClusterCenters() count " + count);
if (isStop(mCenters, mNewCenters, deviation))
break;
else
udpateClusterCenter(mCenters, mNewCenters);
}
// find out the nearest center point for each cluster
findNearestPoint(points, mCenters);
timings.addSplit("findNearestPoint()");
timings.addSplit("processKMean done");
timings.dumpToLog();
}
示例13: onSurfaceChanged
import android.util.TimingLogger; //导入依赖的package包/类
/**
* If the surface changes, reset the view.
* @see Renderer#onSurfaceChanged(GL10, int, int)
*/
public void onSurfaceChanged(GL10 gl, int width, int height) {
((GameActivity) this.context).showProgressDialog();
if(height == 0) { //Prevent A Divide By Zero By
height = 1; //Making Height Equal One
}
Log.d(GlRenderer.class.getSimpleName(), "Screen size: " + Integer.toString(width) + "x" + Integer.toString(height)); // write to log
GlRenderer.surfaceWidth = width;
GlRenderer.surfaceHeight = height;
gl.glViewport(0, 0, width, height); //Reset The Current Viewport
gl.glMatrixMode(GL10.GL_PROJECTION); //Select The Projection Matrix
gl.glLoadIdentity(); //Reset The Projection Matrix
//Create the game perspective
GLU.gluPerspective(gl, GlRenderer.FIELD_OF_VIEW_ANGLE, (float)width / (float)height, GlRenderer.NEAR_CLIPPING_PLANE_DEPTH, GlRenderer.FAR_CLIPPING_PLANE_DEPTH);
gl.glMatrixMode(GL10.GL_MODELVIEW); //Select The Modelview Matrix
gl.glLoadIdentity(); //Reset The Modelview Matrix
TimingLogger timingLogger = new TimingLogger(GlRenderer.class.getSimpleName(), "onSurfaceChanged");
this.gameDrawer.initiaslise(context); //(Re)initialise
this.gameDrawer.loadGame(); //Load all texture
timingLogger.addSplit("loaded all textures");
timingLogger.dumpToLog();
((GameActivity) this.context).dismissProgressDialog();
}
示例14: loadDataOnBackground
import android.util.TimingLogger; //导入依赖的package包/类
@Override
public void loadDataOnBackground() {
super.loadDataOnBackground();
if (DEBUG) timings = new TimingLogger(TAG.substring(0, 21), "loadDataOnBackground");
if (mainView == null)
{
return;
}
final boolean isFirst;
if (uiUpdater != null)
{
isFirst = false;
uiUpdater.setKilled(true);
ChatSDKAbstractConversationsFragmentChatSDKThreadPool.getInstance().removeSchedule(uiUpdater);
}
else
{
isFirst = true;
}
final boolean hasItems = adapter != null && adapter.getThreadItems().size() > 0;
if (isFirst && !hasItems) {
loadData();
}
uiUpdater = new UIUpdater() {
@Override
public void run() {
if (isKilled() && !isFirst && hasItems)
{
return;
}
if (DEBUG) {
timings.addSplit("Loading threads");
}
List list = BNetworkManager.sharedManager().getNetworkAdapter().threadItemsWithType(BThread.Type.Private, adapter.getItemMaker());
if (DEBUG) {
timings.addSplit("Loading threads");
}
uiUpdater = null;
Message message = new Message();
message.obj = list;
message.what = 1;
handler.sendMessageAtFrontOfQueue(message);
if (DEBUG) timings.addSplit("Sending message to handler.");
}
};
ChatSDKAbstractConversationsFragmentChatSDKThreadPool.getInstance().scheduleExecute(uiUpdater,isFirst ? 1 : 0);
}
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:63,代码来源:ChatSDKAbstractConversationsFragment.java
示例15: NV21ToRGBABitmap
import android.util.TimingLogger; //导入依赖的package包/类
@SuppressLint("NewApi")
public static Bitmap NV21ToRGBABitmap(byte []nv21, int width, int height, Context context) {
TimingLogger timings = new TimingLogger(TIMING_LOG_TAG, "NV21ToRGBABitmap");
Rect rect = new Rect(0, 0, width, height);
try {
Class.forName("android.renderscript.Element$DataKind").getField("PIXEL_YUV");
Class.forName("android.renderscript.ScriptIntrinsicYuvToRGB");
byte[] imageData = nv21;
if (mRS == null) {
mRS = RenderScript.create(context);
mYuvToRgb = ScriptIntrinsicYuvToRGB.create(mRS, Element.U8_4(mRS));
Type.Builder tb = new Type.Builder(mRS, Element.createPixel(mRS, Element.DataType.UNSIGNED_8, Element.DataKind.PIXEL_YUV));
tb.setX(width);
tb.setY(height);
tb.setMipmaps(false);
tb.setYuvFormat(ImageFormat.NV21);
ain = Allocation.createTyped(mRS, tb.create(), Allocation.USAGE_SCRIPT);
timings.addSplit("Prepare for ain");
Type.Builder tb2 = new Type.Builder(mRS, Element.RGBA_8888(mRS));
tb2.setX(width);
tb2.setY(height);
tb2.setMipmaps(false);
aOut = Allocation.createTyped(mRS, tb2.create(), Allocation.USAGE_SCRIPT & Allocation.USAGE_SHARED);
timings.addSplit("Prepare for aOut");
bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
timings.addSplit("Create Bitmap");
}
ain.copyFrom(imageData);
timings.addSplit("ain copyFrom");
mYuvToRgb.setInput(ain);
timings.addSplit("setInput ain");
mYuvToRgb.forEach(aOut);
timings.addSplit("NV21 to ARGB forEach");
aOut.copyTo(bitmap);
timings.addSplit("Allocation to Bitmap");
} catch (Exception e) {
YuvImage yuvImage = new YuvImage(nv21, ImageFormat.NV21, width, height, null);
timings.addSplit("NV21 bytes to YuvImage");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
yuvImage.compressToJpeg(rect, 90, baos);
byte[] cur = baos.toByteArray();
timings.addSplit("YuvImage crop and compress to Jpeg Bytes");
bitmap = BitmapFactory.decodeByteArray(cur, 0, cur.length);
timings.addSplit("Jpeg Bytes to Bitmap");
}
timings.dumpToLog();
return bitmap;
}