SP91 Doze参数优化,延长DeviceIdleController.light的IDLE状态驻留

本文主要是介绍SP91 Doze参数优化,延长DeviceIdleController.light的IDLE状态驻留,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

唤醒现象

唤醒时刻 09:29
09-29

唤醒时刻 09:36
09-36

唤醒时刻 09:46
09-46

唤醒时刻 10:00
10-00

唤醒分析

AlarmManager android 的定时 ELAPSED_REALTIME 唤醒

设置定时器-下一个触发时刻为 1312176
11-29 09:26:23.088195   973   973 V AlarmManager: APP set(PendingIntent{d853147: PendingIntentRecord{aa3cd74 android broadcastIntent}}) : type=3 triggerAtTime=1312176 win=0 tElapsed=1312176 maxElapsed=1312176 interval=0 flags=0x1定时器触发 1312176,故台阶波形产生
11-29 09:29:33.090926   973  1213 V AlarmManager: sending alarm Alarm{fb53c89 type 3 when 1312176 android} success设置定时器-下一个触发时刻为 1492175
11-29 09:29:33.094564   973   973 V AlarmManager: APP set(PendingIntent{d853147: PendingIntentRecord{aa3cd74 android broadcastIntent}}) : type=3 triggerAtTime=1492175 win=0 tElapsed=1492175 maxElapsed=1492175 interval=0 flags=0x1
11-29 09:29:33.094939   973   973 D AlarmManager: set alarm to RTC 1492175 Type: 3定时器触发 1492175,故台阶波形产生
11-29 09:36:22.099205   973  1213 V AlarmManager: sending alarm Alarm{c4e54af type 3 when 1492175 android} success设置定时器-下一个触发时刻为 1912175
11-29 09:36:22.112267   973   973 V AlarmManager: APP set(PendingIntent{d853147: PendingIntentRecord{aa3cd74 android broadcastIntent}}) : type=3 triggerAtTime=1912175 win=0 tElapsed=1912175 maxElapsed=1912175 interval=0 flags=0x1
11-29 09:36:22.112592   973   973 D AlarmManager: set alarm to RTC 1912175 Type: 3定时器触发 1912175,故台阶波形产生
11-29 09:46:23.087939   973  1213 V AlarmManager: sending alarm Alarm{1b58ccb type 3 when 1912175 android} success设置定时器-下一个触发时刻为 2512176
11-29 09:46:23.098627   973   973 V AlarmManager: APP set(PendingIntent{d853147: PendingIntentRecord{aa3cd74 android broadcastIntent}}) : type=3 triggerAtTime=2512176 win=0 tElapsed=2512176 maxElapsed=2512176 interval=0 flags=0x1
11-29 09:46:23.099062   973   973 D AlarmManager: set alarm to RTC 2512176 Type: 3定时器触发 2512176,故台阶波形产生
11-29 10:00:01.093812   973  1213 V AlarmManager: sending alarm Alarm{c7af3c1 type 3 when 2512176 android} success设置定时器-下一个触发时刻为 3352176
11-29 10:00:01.098752   973   973 V AlarmManager: APP set(PendingIntent{d853147: PendingIntentRecord{aa3cd74 android broadcastIntent}}) : type=3 triggerAtTime=3352176 win=0 tElapsed=3352176 maxElapsed=3352176 interval=0 flags=0x1
11-29 10:00:01.099113   973   973 D AlarmManager: set alarm to RTC 3352176 Type: 3定时器触发 3352176,但是波形图不是 10:11 而是 1005
11-29 10:11:54.766607   973   973 V AlarmManager: sending alarm Alarm{22c0f4a type 3 when 3352176 android} success

DeviceIdleController.light 定时器 ELAPSED_REALTIME_WAKEUP 唤醒

DeviceIdleController.light 设置定时器-下一个触发时刻为 1464102
11-29 09:24:31.927   973   973 V AlarmManager: APP set with listener(DeviceIdleController.light) : type=2 triggerAtTime=1464102 win=-1 tElapsed=1464102 maxElapsed=1689101 interval=0 flags=0x8
11-29 09:26:23.078   973  1213 D AlarmManager: set alarm to RTC 1464102 Type: 2定时器触发 1464102,故台阶波形产生,且满足波形图时间
11-29 09:29:33.093   973  1213 D AlarmManager: wakeup alarm = Alarm{392b48e type 2 when 1464102 android}; listener package = DeviceIdleController.lightneedGrouping = falseDeviceIdleController.light 设置定时器-下一个触发时刻为 1765269
11-29 09:29:33.111   973  1003 V AlarmManager: APP set with listener(DeviceIdleController.light) : type=2 triggerAtTime=1765269 win=-1 tElapsed=1765269 maxElapsed=1990269 interval=0 flags=0x8定时器触发 1765269,故台阶波形产生,且满足波形图时间
11-29 09:36:22.102   973  1213 D AlarmManager: wakeup alarm = Alarm{98190bc type 2 when 1765269 android}; listener package = DeviceIdleController.lightneedGrouping = falseDeviceIdleController.light 设置定时器-下一个触发时刻为 2474279
11-29 09:36:22.110   973  1003 V AlarmManager: APP set with listener(DeviceIdleController.light) : type=2 triggerAtTime=2474279 win=-1 tElapsed=2474279 maxElapsed=2924273 interval=0 flags=0x8
11-29 09:36:22.111   973  1003 D AlarmManager: set alarm to RTC 2474279 Type: 2DeviceIdleController.light 设置定时器-下一个触发时刻为 2535269
11-29 09:46:23.094   973  1003 V AlarmManager: APP set with listener(DeviceIdleController.light) : type=2 triggerAtTime=2535269 win=-1 tElapsed=2535269 maxElapsed=2580268 interval=0 flags=0x8
11-29 09:46:23.098   973  1003 D AlarmManager: set alarm to RTC 2535269 Type: 2DeviceIdleController.light 设置定时器-下一个触发时刻为 3080487
11-29 09:46:28.312   973  1003 V AlarmManager: APP set with listener(DeviceIdleController.light) : type=2 triggerAtTime=3080487 win=-1 tElapsed=3080487 maxElapsed=3530487 interval=0 flags=0x8定时器触发 3080487,故台阶波形产生,且满足波形图时间
11-29 10:00:01.094   973  1213 D AlarmManager: wakeup alarm = Alarm{ee4c766 type 2 when 3080487 android}; listener package = DeviceIdleController.lightneedGrouping = falseDeviceIdleController.light 设置定时器-下一个触发时刻为 4193320
11-29 10:00:01.145   973  1003 V AlarmManager: APP set with listener(DeviceIdleController.light) : type=2 triggerAtTime=4193320 win=-1 tElapsed=4193320 maxElapsed=4868320 interval=0 flags=0x811-29 10:00:01.146   973  1003 D AlarmManager: set alarm to RTC 4193320 Type: 2

题外-定时器类型

83public class AlarmManager {
84    private static final String TAG = "AlarmManager";
85
86    /**
87     * Alarm time in {@link System#currentTimeMillis System.currentTimeMillis()}
88     * (wall clock time in UTC), which will wake up the device when
89     * it goes off.
90     */
91    public static final int RTC_WAKEUP = 0;
92    /**
93     * Alarm time in {@link System#currentTimeMillis System.currentTimeMillis()}
94     * (wall clock time in UTC).  This alarm does not wake the
95     * device up; if it goes off while the device is asleep, it will not be
96     * delivered until the next time the device wakes up.
97     */
98    public static final int RTC = 1;
99    /**
100     * Alarm time in {@link android.os.SystemClock#elapsedRealtime
101     * SystemClock.elapsedRealtime()} (time since boot, including sleep),
102     * which will wake up the device when it goes off.
103     */
104    public static final int ELAPSED_REALTIME_WAKEUP = 2;
105    /**
106     * Alarm time in {@link android.os.SystemClock#elapsedRealtime
107     * SystemClock.elapsedRealtime()} (time since boot, including sleep).
108     * This alarm does not wake the device up; if it goes off while the device
109     * is asleep, it will not be delivered until the next time the device
110     * wakes up.
111     */
112    public static final int ELAPSED_REALTIME = 3

源码分析

定时器相关源码

/frameworks/base/services/core/java/com/android/server/AlarmManagerService.java

    void setImpl(int type, long triggerAtTime, long windowLength, long interval,PendingIntent operation, IAlarmListener directReceiver, String listenerTag,int flags, WorkSource workSource, AlarmManager.AlarmClockInfo alarmClock,int callingUid, String callingPackage) {synchronized (mLock) {if (true) {if (operation == null) {Slog.v(TAG, "APP set with listener(" + listenerTag + ") : type=" + type+ " triggerAtTime=" + triggerAtTime + " win=" + windowLength+ " tElapsed=" + triggerElapsed + " maxElapsed=" + maxElapsed+ " interval=" + interval + " flags=0x" + Integer.toHexString(flags));} else {Slog.v(TAG, "APP set(" + operation + ") : type=" + type+ " triggerAtTime=" + triggerAtTime + " win=" + windowLength+ " tElapsed=" + triggerElapsed + " maxElapsed=" + maxElapsed+ " interval=" + interval + " flags=0x" + Integer.toHexString(flags));}}setImplLocked(type, triggerAtTime, triggerElapsed, windowLength, maxElapsed,interval, operation, directReceiver, listenerTag, flags, true, workSource,alarmClock, callingUid, callingPackage, mNeedGrouping);}

DeviceIdleController 设置定时

frameworks\base\services\core\java\com\android\server\DeviceIdleController.java

package com.android.server;/*** Keeps track of device idleness and drives low power mode based on that.*/
public class DeviceIdleController extends SystemServiceimplements AnyMotionDetector.DeviceIdleCallback {void scheduleLightAlarmLocked(long delay) {if (DEBUG) Slog.d(TAG, "scheduleLightAlarmLocked(" + delay + ")");mNextLightAlarmTime = SystemClock.elapsedRealtime() + delay;mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,mNextLightAlarmTime, "DeviceIdleController.light", mLightAlarmListener, mHandler);}

源码修改

我们可以延长 IDLE 模式的驻留时间, 单位时间内减少其LIGHT_STATE_IDLE to LIGHT_STATE_IDLE_MAINTENANCE或LIGHT_WAITING_FOR_NETWORK的次数,优化电池

package com.android.server;/*** Keeps track of device idleness and drives low power mode based on that.*/
public class DeviceIdleController extends SystemServiceimplements AnyMotionDetector.DeviceIdleCallback {private static final boolean DEBUG = true;// LIGHT_IDLE 的驻留时间是 [15, 30]分钟// suhuazhi,20171220, for extend duration of idleLIGHT_IDLE_TIMEOUT = mParser.getLong(KEY_LIGHT_IDLE_TIMEOUT,!COMPRESS_TIME ? 15 * 60 * 1000L : 15 * 1000L);LIGHT_IDLE_FACTOR = mParser.getFloat(KEY_LIGHT_IDLE_FACTOR,3f);LIGHT_MAX_IDLE_TIMEOUT = mParser.getLong(KEY_LIGHT_MAX_IDLE_TIMEOUT,!COMPRESS_TIME ? 30 * 60 * 1000L : 60 * 1000L);// end if
=======================================================================================
// 原来的 LIGHT_IDLE 的驻留时间是 [5, 15]分钟LIGHT_IDLE_TIMEOUT = mParser.getLong(KEY_LIGHT_IDLE_TIMEOUT,!COMPRESS_TIME ? 5 * 60 * 1000L : 15 * 1000L);LIGHT_IDLE_FACTOR = mParser.getFloat(KEY_LIGHT_IDLE_FACTOR,2f);LIGHT_MAX_IDLE_TIMEOUT = mParser.getLong(KEY_LIGHT_MAX_IDLE_TIMEOUT,!COMPRESS_TIME ? 15 * 60 * 1000L : 60 * 1000L);

延长对应的 延长 IDLE 模式的驻留时间

======================================================================switch (mLightState) {case LIGHT_STATE_INACTIVE:// Reset the upcoming idle delays.mNextLightIdleDelay = mConstants.LIGHT_IDLE_TIMEOUT;break;case LIGHT_STATE_PRE_IDLE:case LIGHT_STATE_IDLE_MAINTENANCE:.......scheduleLightAlarmLocked(mNextLightIdleDelay);mNextLightIdleDelay = Math.min(mConstants.LIGHT_MAX_IDLE_TIMEOUT,(long)(mNextLightIdleDelay * mConstants.LIGHT_IDLE_FACTOR));if (mNextLightIdleDelay < mConstants.LIGHT_IDLE_TIMEOUT) {mNextLightIdleDelay = mConstants.LIGHT_IDLE_TIMEOUT;}.....if (DEBUG) Slog.d(TAG, "Moved to LIGHT_STATE_IDLE. mNextLightIdleDelay = " + mNextLightIdleDelay);mLightState = LIGHT_STATE_IDLE;break;case LIGHT_STATE_WAITING_FOR_NETWORK:if (mNetworkConnected || mLightState == LIGHT_STATE_WAITING_FOR_NETWORK) {} else {// We'd like to do maintenance, but currently don't have network// connectivity...  let's try to wait until the network comes back.// We'll only wait for another full idle period, however, and then give up.scheduleLightAlarmLocked(mNextLightIdleDelay);if (DEBUG) Slog.d(TAG, "Moved to LIGHT_WAITING_FOR_NETWORK. mNextLightIdleDelay = " + mNextLightIdleDelay);mLightState = LIGHT_STATE_WAITING_FOR_NETWORK;}======================================================================

优化效果

优化前数据
  • Doze的状态切换
3,108: 11-29 14:59:18.953134   964   964 D DeviceIdleController: Moved from STATE_ACTIVE to STATE_INACTIVE 
3,111: 11-29 14:59:18.953422   964   964 D DeviceIdleController: Moved from LIGHT_STATE_ACTIVE to LIGHT_STATE_INACTIVE 
3,197: 11-29 15:04:20.131240   964   992 D DeviceIdleController: Moved to LIGHT_STATE_IDLE. 
<5分钟间隔>
3,229: 11-29 15:09:21.098920   964   992 D DeviceIdleController: Moved to LIGHT_WAITING_FOR_NETWORK. 
<15分钟间隔>
3,262: 11-29 15:26:07.132630   964   992 D DeviceIdleController: Moved from LIGHT_STATE_IDLE to LIGHT_STATE_IDLE_MAINTENANCE. 
3,276: 11-29 15:26:12.319049   964   992 D DeviceIdleController: Moved to LIGHT_STATE_IDLE. 
<10分钟间隔>
3,314: 11-29 15:36:13.122641   964   992 D DeviceIdleController: Moved to LIGHT_WAITING_FOR_NETWORK. 
<15分钟间隔>
3,331: 11-29 15:51:14.110387   964   992 D DeviceIdleController: Moved from LIGHT_STATE_IDLE to LIGHT_STATE_IDLE_MAINTENANCE. 
3,353: 11-29 15:51:19.297282   964   992 D DeviceIdleController: Moved to LIGHT_STATE_IDLE. 
<20分钟间隔>
3,419: 11-29 16:10:21.125400   964   992 D DeviceIdleController: Moved to LIGHT_WAITING_FOR_NETWORK. 
<15分钟间隔>
3,455: 11-29 16:26:07.140463   964   992 D DeviceIdleController: Moved from LIGHT_STATE_IDLE to LIGHT_STATE_IDLE_MAINTENANCE. 
3,469: 11-29 16:26:12.304652   964   992 D DeviceIdleController: Moved to LIGHT_STATE_IDLE.
  • 唤醒时间间隔
    总时长 1小时半
3,113: 11-29 14:59:18.953767   964   964 V AlarmManager: APP set with listener(DeviceIdleController.light) : type=2 triggerAtTime=565319 win=-1 tElapsed=565319 maxElapsed=790319 interval=0 flags=0x8 
3,193: 11-29 15:04:20.104443   964   992 V AlarmManager: APP set with listener(DeviceIdleController.light) : type=2 triggerAtTime=866461 win=-1 tElapsed=866461 maxElapsed=1091461 interval=0 flags=0x8 
<5分钟间隔>
3,228: 11-29 15:09:21.098108   964   992 V AlarmManager: APP set with listener(DeviceIdleController.light) : type=2 triggerAtTime=1467463 win=-1 tElapsed=1467463 maxElapsed=1917463 interval=0 flags=0x8 
<15分钟间隔>
3,254: 11-29 15:26:07.126923   964   992 V AlarmManager: APP set with listener(DeviceIdleController.light) : type=2 triggerAtTime=1933461 win=-1 tElapsed=1933461 maxElapsed=1978461 interval=0 flags=0x8 
3,272: 11-29 15:26:12.313214   964   992 V AlarmManager: APP set with listener(DeviceIdleController.light) : type=2 triggerAtTime=2478678 win=-1 tElapsed=2478678 maxElapsed=2928678 interval=0 flags=0x8 
<10分钟间隔>
3,312: 11-29 15:36:13.120175   964   992 V AlarmManager: APP set with listener(DeviceIdleController.light) : type=2 triggerAtTime=3379485 win=-1 tElapsed=3379485 maxElapsed=4054485 interval=0 flags=0x8 
<15分钟间隔>
3,329: 11-29 15:51:14.105569   964   992 V AlarmManager: APP set with listener(DeviceIdleController.light) : type=2 triggerAtTime=3495252 win=-1 tElapsed=3495252 maxElapsed=3581337 interval=0 flags=0x8 
3,350: 11-29 15:51:19.291767   964   992 V AlarmManager: APP set with listener(DeviceIdleController.light) : type=2 triggerAtTime=4285656 win=-1 tElapsed=4285656 maxElapsed=4960656 interval=0 flags=0x8 
<20分钟间隔>
3,416: 11-29 16:10:21.116175   964   992 V AlarmManager: APP set with listener(DeviceIdleController.light) : type=2 triggerAtTime=5427480 win=-1 tElapsed=5427480 maxElapsed=6102480 interval=0 flags=0x8 
<15分钟间隔>
3,447: 11-29 16:26:07.128173   964   992 V AlarmManager: APP set with listener(DeviceIdleController.light) : type=2 triggerAtTime=5643059 win=-1 tElapsed=5643059 maxElapsed=5770233 interval=0 flags=0x8 
3,465: 11-29 16:26:12.299088   964   992 V AlarmManager: APP set with listener(DeviceIdleController.light) : type=2 triggerAtTime=6378664 win=-1 tElapsed=6378664 maxElapsed=7053664 interval=0 flags=0x8 
优化后数据,预计拉长上述的时间间隔
  • Doze的状态切换
2,041: 01-01 02:30:51.073802   977   977 D DeviceIdleController: Moved from STATE_ACTIVE to STATE_INACTIVE 
2,044: 01-01 02:30:51.074208   977   977 D DeviceIdleController: Moved from LIGHT_STATE_ACTIVE to LIGHT_STATE_INACTIVE 
2,866: 12-29 18:42:10.965973   977   977 D DeviceIdleController: Moved from STATE_ACTIVE to STATE_INACTIVE 
2,869: 12-29 18:42:10.966274   977   977 D DeviceIdleController: Moved from LIGHT_STATE_ACTIVE to LIGHT_STATE_INACTIVE 
<5分钟间隔>
2,934: 12-29 18:47:12.144441   977  1005 D DeviceIdleController: Moved to scheduleLightAlarmLocked mNextLightIdleDelay 900000 
2,935: 12-29 18:47:12.144598   977  1005 D DeviceIdleController: Moved to LIGHT_STATE_IDLE. mNextLightIdleDelay 1800000 
<15分钟间隔>
2,980: 12-29 19:02:13.117638   977  1005 D DeviceIdleController: Moved to LIGHT_WAITING_FOR_NETWORK. mNextLightIdleDelay = 1800000 
<30分钟间隔>
3,015: 12-29 19:32:14.151051   977  1005 D DeviceIdleController: Moved from LIGHT_STATE_IDLE to LIGHT_STATE_IDLE_MAINTENANCE. 
3,033: 12-29 19:32:19.319212   977  1005 D DeviceIdleController: Moved to scheduleLightAlarmLocked mNextLightIdleDelay 1800000 
3,034: 12-29 19:32:19.319374   977  1005 D DeviceIdleController: Moved to LIGHT_STATE_IDLE. mNextLightIdleDelay 1800000 
  • 唤醒时间间隔
2,871: 12-29 18:42:10.966672   977   977 V AlarmManager: APP set with listener(DeviceIdleController.light) : type=2 triggerAtTime=3887071 win=-1 tElapsed=3887071 maxElapsed=4112071 interval=0 flags=0x8 
<5分钟间隔>
2,931: 12-29 18:47:12.133963   977  1005 V AlarmManager: APP set with listener(DeviceIdleController.light) : type=2 triggerAtTime=4788238 win=-1 tElapsed=4788238 maxElapsed=5463238 interval=0 flags=0x8 
<15分钟间隔>
2,978: 12-29 19:02:13.103318   977  1005 V AlarmManager: APP set with listener(DeviceIdleController.light) : type=2 triggerAtTime=6589207 win=-1 tElapsed=6589207 maxElapsed=7939207 interval=0 flags=0x8 
<30分钟间隔>
3,013: 12-29 19:32:14.149906   977  1005 V AlarmManager: APP set with listener(DeviceIdleController.light) : type=2 triggerAtTime=6650253 win=-1 tElapsed=6650253 maxElapsed=6695252 interval=0 flags=0x8 
3,030: 12-29 19:32:19.313706   977  1005 V AlarmManager: APP set with listener(DeviceIdleController.light) : type=2 triggerAtTime=8395418 win=-1 tElapsed=8395418 maxElapsed=9745418 interval=0 flags=0x8 

优化后,相同时长下,唤醒次数少了一半,且主要是拉长LIGHT_STATE_IDLE待机的驻留期,让LIGHT_WAITING_FOR_NETWORK和LIGHT_STATE_IDLE_MAINTENANCE的状态少一些刷新
但是又不对有网络下的MAINTENANCE造成太大影响

这篇关于SP91 Doze参数优化,延长DeviceIdleController.light的IDLE状态驻留的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/695311

相关文章

uniapp接入微信小程序原生代码配置方案(优化版)

uniapp项目需要把微信小程序原生语法的功能代码嵌套过来,无需把原生代码转换为uniapp,可以配置拷贝的方式集成过来 1、拷贝代码包到src目录 2、vue.config.js中配置原生代码包直接拷贝到编译目录中 3、pages.json中配置分包目录,原生入口组件的路径 4、manifest.json中配置分包,使用原生组件 5、需要把原生代码包里的页面修改成组件的方

ABAP怎么把传入的参数刷新到内表里面呢?

1.在执行相关的功能操作之前,优先执行这一段代码,把输入的数据更新入内表里面 DATA: lo_guid TYPE REF TO cl_gui_alv_grid.CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'IMPORTINGe_grid = lo_guid.CALL METHOD lo_guid->check_changed_data.CALL M

Java面试八股之JVM参数-XX:+UseCompressedOops的作用

JVM参数-XX:+UseCompressedOops的作用 JVM参数-XX:+UseCompressedOops的作用是启用对象指针压缩(Ordinary Object Pointers compression)。这一特性主要应用于64位的Java虚拟机中,目的是为了减少内存使用。在传统的64位系统中,对象引用(即指针)通常占用8字节(64位),而大部分应用程序实际上并不需要如此大的地址空间

服务器雪崩的应对策略之----SQL优化

SQL语句的优化是数据库性能优化的重要方面,特别是在处理大规模数据或高频访问时。作为一个C++程序员,理解SQL优化不仅有助于编写高效的数据库操作代码,还能增强对系统性能瓶颈的整体把握。以下是详细的SQL语句优化技巧和策略: SQL优化 1. 选择合适的数据类型2. 使用索引3. 优化查询4. 范式化和反范式化5. 查询重写6. 使用缓存7. 优化数据库设计8. 分析和监控9. 调整配置1、

Java中如何优化数据库查询性能?

Java中如何优化数据库查询性能? 大家好,我是免费搭建查券返利机器人省钱赚佣金就用微赚淘客系统3.0的小编,也是冬天不穿秋裤,天冷也要风度的程序猿!今天我们将深入探讨在Java中如何优化数据库查询性能,这是提升应用程序响应速度和用户体验的关键技术。 优化数据库查询性能的重要性 在现代应用开发中,数据库查询是最常见的操作之一。随着数据量的增加和业务复杂度的提升,数据库查询的性能优化显得尤为重

打包体积分析和优化

webpack分析工具:webpack-bundle-analyzer 1. 通过<script src="./vue.js"></script>方式引入vue、vuex、vue-router等包(CDN) // webpack.config.jsif(process.env.NODE_ENV==='production') {module.exports = {devtool: 'none

关于命令行参数argv(《学习OpenCV》)

在《学习OpenCV》这本书中,很多示例代码都用到了命令行参数。作为新手,之前总是很困扰,不知道怎么用。偶然的机会终于略知一二了。 在Visual Studio中,我们可以自行设置命令行参数。 如在这个示例程序中,我们想把图像存入argv[1]。 方法如下: 依次点击,项目、属性、配置属性、调试、命令参数。出现下面的界面: 然后进行编辑,即输入图像路径。如:E:\Lena.jpg

Clickhouse 的性能优化实践总结

文章目录 前言性能优化的原则数据结构优化内存优化磁盘优化网络优化CPU优化查询优化数据迁移优化 前言 ClickHouse是一个性能很强的OLAP数据库,性能强是建立在专业运维之上的,需要专业运维人员依据不同的业务需求对ClickHouse进行有针对性的优化。同一批数据,在不同的业务下,查询性能可能出现两极分化。 性能优化的原则 在进行ClickHouse性能优化时,有几条

HTTP状态码中301与302的区别

一.官方说法  301,302 都是HTTP状态的编码,都代表着某个URL发生了转移,不同之处在于:  301 redirect: 301 代表永久性转移(Permanently Moved)。  302 redirect: 302 代表暂时性转移(Temporarily Moved )。  这是很官方的说法,那么它们的区别到底是什么呢?  1.1、什么是301转向?什么是301重定向?

群体优化算法---电磁共振优化算法(EROA)介绍包含示例滤波器设计

介绍 电磁共振优化算法(Electromagnetic Resonance Optimization Algorithm, EROA)是一种新型的元启发式优化算法,其灵感来源于电磁共振现象。电磁共振是一种物理现象,当一个系统在特定频率下响应最大时,这个频率被称为共振频率。在优化算法中,共振频率可以用来引导搜索过程,提高优化效率 EROA 算法的基本原理 种群初始化: 在搜索空间内随机生成一定